def munge(s: str, allow_builtins: bool = False) -> str:
new_str = []<EOL>for c in s:<EOL><INDENT>new_str.append(_MUNGE_REPLACEMENTS.get(c, c))<EOL><DEDENT>new_s = "<STR_LIT>".join(new_str)<EOL>if keyword.iskeyword(new_s):<EOL><INDENT>return f"<STR_LIT>"<EOL><DEDENT>if not allow_builtins and new_s in builtins.__dict__:<EOL><INDENT>return f"<STR_LIT>"<EOL><DEDENT>return new_s<EOL>
Replace characters which are not valid in Python symbols
    with valid replacement strings.