input: Write a function to calculate the sum of all elements in a given binary tree. If the given tree is empty then return 0.
  def sum_tree(root):
      if root is None:
          return 0
  
      return root.val + sum_tree(root.left) + sum_tree(root.right)
  assert sum_tree(None)==0
  assert sum_tree(TreeNode(1, TreeNode(2, TreeNode(3), None), TreeNode(4)))==10
  assert sum_tree(TreeNode(5, None, TreeNode(8, TreeNode(2), TreeNode(4))))==19
  assert sum_tree(TreeNode(1, TreeNode(2, TreeNode(3), TreeNode(4)), TreeNode(5, TreeNode(6), TreeNode(7))))==28
output: def sum_tree(root):
      if root is None:
          return 0
  
      return root.val + sum_tree(root.left) + sum_tree(root.right)