def get_code_indices(s: Any) -> Dict[int, str]:
indices = {}<EOL>i = <NUM_LIT:0><EOL>codes = get_codes(s)<EOL>for code in codes:<EOL><INDENT>codeindex = s.index(code)<EOL>realindex = i + codeindex<EOL>indices[realindex] = code<EOL>codelen = len(code)<EOL>i = realindex + codelen<EOL>s = s[codeindex + codelen:]<EOL><DEDENT>return indices<EOL>
Retrieve a dict of {index: escape_code} for a given string.
        If no escape codes are found, an empty dict is returned.