How would you solve a tree problem using depth-first search?
Given the root of a binary tree, return the sum of all node values in the tree. You may solve it recursively or iteratively, but the traversal must use depth-first search.
def tree_sum(root):
root: the root node of a binary tree, or Nonedef tree_sum(root):