def bel_completion(<EOL>belstr: str,<EOL>cursor_loc: int = -<NUM_LIT:1>,<EOL>bel_version: str = default_bel_version,<EOL>bel_comp: str = None,<EOL>bel_fmt: str = "<STR_LIT>",<EOL>species_id: str = None,<EOL>size: int = <NUM_LIT:20>,<EOL>) -> Mapping[str, Any]:
"""<STR_LIT>"""<EOL>bel_spec = bel_specification.get_specification(bel_version)<EOL>belstrlen = len(belstr)<EOL>if cursor_loc == -<NUM_LIT:1>:<EOL><INDENT>cursor_loc = belstrlen - <NUM_LIT:1><EOL><DEDENT>elif cursor_loc >= belstrlen:<EOL><INDENT>cursor_loc = belstrlen - <NUM_LIT:1><EOL><DEDENT>(completion_text, completions, function_help, spans) = get_completions(<EOL>belstr, cursor_loc, bel_spec, bel_comp, bel_fmt, species_id, size<EOL>)<EOL>return {<EOL>"<STR_LIT>": completion_text,<EOL>"<STR_LIT>": completions,<EOL>"<STR_LIT>": function_help,<EOL>"<STR_LIT>": spans,<EOL>}<EOL>
BEL Completion

    Args:
        belstr (str): BEL String to provide completion for
        cursor_loc (int): cursor location - default of -1 means end of string
        bel_version (str): BEL Language version to use for completion
        bel_comp (str): ['subject', 'object', 'full', None] - a nested statement has to be found in object or full statement
        bel_fmt (str): ['short', 'medium', 'long'] BEL function/relation format
        species_id (str): optional, species id is used to filter namespace values if applicable (e.g. Gene, RNA, ... entity_types)
        size: how many completions to return, defaults to 20

    Returns:
        Mapping[str, Any]:
            {
                'completions': completions,
                'function_help': function_help,
                'entity_spans': spans
            }