def get_permittee_from_threadlocals(kw):
    # Just skip if perm checks are disabled
    if not ExpedientPermission.objects.are_checks_enabled():
        return None
    
    d = threadlocals.get_thread_locals()
    logger.debug("Got threadlocals %s" % d)
    try:
        permittee = d[kw]
    except KeyError:
        raise PermitteeNotInThreadLocals(kw)
    if not permittee:
        raise NonePermitteeException(kw)
    
    return permittee
Wrapper to get a permittee keyword from threadlocals and make sure it is
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/permissions/shortcuts.py/get_permittee_from_threadlocals