def traverse_node(node: ast.AST) -> Iterator[ast.AST]:
    """Recursively yield node and all its children in depth-first order."""
    yield node
    for child in ast.iter_child_nodes(node):
        yield from traverse_node(child)
Recursively yield node and all its children in depth-first order.
src/_pytest/assertion/rewrite.py