def add_completions(<EOL>replace_list: list, belstr: str, replace_span: Span, completion_text: str<EOL>) -> List[Mapping[str, Any]]:
completions = []<EOL>for r in replace_list:<EOL><INDENT>if len(belstr) > <NUM_LIT:0>:<EOL><INDENT>belstr_end = len(belstr) - <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>belstr_end = <NUM_LIT:0><EOL><DEDENT>log.debug(<EOL>f'<STR_LIT>'<EOL>)<EOL>if (<EOL>r["<STR_LIT:type>"] == "<STR_LIT>"<EOL>and replace_span[<NUM_LIT:0>] > <NUM_LIT:0><EOL>and belstr[replace_span[<NUM_LIT:0>] - <NUM_LIT:1>] == "<STR_LIT:U+002C>"<EOL>):<EOL><INDENT>log.debug("<STR_LIT>")<EOL>replacement = (<EOL>belstr[<NUM_LIT:0> : replace_span[<NUM_LIT:0>]]<EOL>+ "<STR_LIT:U+0020>"<EOL>+ f"<STR_LIT>"<EOL>+ belstr[replace_span[<NUM_LIT:1>] + <NUM_LIT:1> :]<EOL>)<EOL>cursor_loc = len(<EOL>belstr[<NUM_LIT:0> : replace_span[<NUM_LIT:0>]] + "<STR_LIT:U+0020>" + f"<STR_LIT>"<EOL>)<EOL><DEDENT>elif replace_span[<NUM_LIT:0>] > <NUM_LIT:0> and belstr[replace_span[<NUM_LIT:0>] - <NUM_LIT:1>] == "<STR_LIT:U+002C>":<EOL><INDENT>log.debug("<STR_LIT>")<EOL>replacement = (<EOL>belstr[<NUM_LIT:0> : replace_span[<NUM_LIT:0>]]<EOL>+ "<STR_LIT:U+0020>"<EOL>+ r["<STR_LIT>"]<EOL>+ belstr[replace_span[<NUM_LIT:1>] + <NUM_LIT:1> :]<EOL>)<EOL>cursor_loc = len(belstr[<NUM_LIT:0> : replace_span[<NUM_LIT:0>]] + "<STR_LIT:U+0020>" + r["<STR_LIT>"])<EOL><DEDENT>elif r["<STR_LIT:type>"] == "<STR_LIT>" and replace_span[<NUM_LIT:1>] >= belstr_end:<EOL><INDENT>replacement = belstr[<NUM_LIT:0> : replace_span[<NUM_LIT:0>]] + f"<STR_LIT>"<EOL>cursor_loc = len(replacement) - <NUM_LIT:1>  <EOL>log.debug(f"<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>replacement = (<EOL>belstr[<NUM_LIT:0> : replace_span[<NUM_LIT:0>]]<EOL>+ r["<STR_LIT>"]<EOL>+ belstr[replace_span[<NUM_LIT:1>] + <NUM_LIT:1> :]<EOL>)<EOL>cursor_loc = len(<EOL>belstr[<NUM_LIT:0> : replace_span[<NUM_LIT:0>]] + r["<STR_LIT>"]<EOL>)  <EOL><DEDENT>completions.append(<EOL>{<EOL>"<STR_LIT>": replacement,<EOL>"<STR_LIT>": cursor_loc,<EOL>"<STR_LIT>": r["<STR_LIT>"],<EOL>"<STR_LIT:label>": r["<STR_LIT:label>"],<EOL>}<EOL>)<EOL><DEDENT>return completions<EOL>
Create completions to return given replacement list

    Args:
        replace_list: list of completion replacement values
        belstr: BEL String
        replace_span: start, stop of belstr to replace
        completion_text: text to use for completion - used for creating highlight
    Returns:
        [{
            "replacement": replacement,
            "cursor_loc": cursor_loc,
            "highlight": highlight,
            "label": label,
        }]