<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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))