def METHOD_NAME(tree: ast.AST) -> None:
    """Walks AST tree and sets the `parent` attr in each node to the node's parent. Toplevel nodes (parent is a `tree`) have the `parent` attr set to None."""
    for node in ast.walk(tree):
        for child in ast.iter_child_nodes(node):
            child.parent = node if node is not tree else None  # type: ignore