def __call__(self, f, prewrapper_func=None):
        def require_obj_permissions_wrapper(obj, *args, **kw):
            """
            Wrapper for the called method that checks the permissions before
            calling the method.
            """
            # check for the permission
            try:
                if self.pop_user_kw:
                    user = kw.pop(self.user_kw)
                else:
                    user = kw[self.user_kw]
            except KeyError:
                raise PermissionSignatureError(self.user_kw)

            missing, temp = ExpedientPermission.objects.get_missing_for_target(
                user, self.perm_names, obj)

            if missing:
                raise PermissionDenied(missing.name, obj, user)
            
            # All is good. Call the function
            return f(obj, *args, **kw)
        
        # call the prewrapper if it is defined
        if prewrapper_func:
            return prewrapper_func(require_obj_permissions_wrapper)
        else:
            return require_obj_permissions_wrapper
Capture a time lapse.
dataset/ETHPy150Open fp7-ofelia/ocf/optin_manager/src/python/openflow/common/permissions/decorators.py/require_obj_permissions.__call__--crossover with--dataset/ETHPy150Open miguelgrinberg/oreilly-flask-apis-video/camera/camera.py/PiCamera.capture_timelapse