def autoload_filenode(must_be=None, default_root=False):
    """Implies both must_have_addon osfstorage node and
    handle_odm_errors
    Attempts to load fid as a OsfStorageFileNode with viable constraints
    """
    def _autoload_filenode(func):
        @handle_odm_errors
        @must_have_addon('osfstorage', 'node')
        @functools.wraps(func)
        def wrapped(*args, **kwargs):
            node = kwargs['node']

            if kwargs not in 'fid' and default_root:
                file_node = kwargs['node_addon'].get_root()
            else:
                file_node = models.OsfStorageFileNode.get(kwargs.get('fid'), node)

            if must_be and file_node.kind != must_be:
                raise HTTPError(httplib.BAD_REQUEST, data={
                    'message_short': 'incorrect type',
                    'message_long': 'FileNode must be of type {} not {}'.format(must_be, file_node.kind)
                })

            kwargs['file_node'] = file_node

            return func(*args, **kwargs)

        return wrapped
    return _autoload_filenode
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/osfstorage/decorators.py/autoload_filenode/swapped operands of `not in`