import ylock

from django.conf import settings


manager = ylock.backends.create_manager(**settings.YLOCK)


def lock_from_context(context):
    ctx = ylock.backends.mongodb.MongoDBLockContext(*context)
    return manager.lock_from_context(ctx)
