def waterbutler_opt_hook(func):

    @must_be_signed
    @handle_odm_errors
    @must_not_be_registration
    @must_have_addon('osfstorage', 'node')
    @functools.wraps(func)
    def wrapped(payload, *args, **kwargs):
        try:
            user = User.load(payload['user'])
            dest_node = Node.load(payload['destination']['node'])
            source = models.OsfStorageFileNode.get(payload['source'], kwargs['node'])
            dest_parent = models.OsfStorageFolder.get(payload['destination']['parent'], dest_node)

            kwargs.update({
                'user': user,
                'source': source,
                'destination': dest_parent,
                'name': payload['destination']['name'],
            })
        except __HOLE__:
            raise HTTPError(httplib.BAD_REQUEST)

        return func(*args, **kwargs)
    return wrapped
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/osfstorage/decorators.py/waterbutler_opt_hook