def replace_name(expr: AST, old_name: str, new_name: str) -> AST:
    """Replace all Name nodes named `old_name` with nodes named `new_name`."""
    return _NameReplacer(old_name, new_name).visit(deepcopy(expr))
Replace all Name nodes named `old_name` with nodes named `new_name`.