def function(name, range=False, sync=False, eval=None):
    def dec(f):
        f._nvim_rpc_method_name = 'function:{0}'.format(name)
        f._nvim_rpc_sync = sync
        f._nvim_bind = True
        f._nvim_prefix_plugin_path = True

        opts = {}

        if range:
            opts['range'] = '' if range is True else str(range)

        if eval:
            opts['eval'] = eval

        f._nvim_rpc_spec = {
            'type': 'function',
            'name': name,
            'sync': sync,
            'opts': opts
        }
        return f
    return dec
Tag a function or plugin method as a Nvim function handler.
dataset/ETHPy150Open neovim/python-client/neovim/plugin/decorators.py/function