input: Write a function to determine if two given binary trees are similar. Similar binary trees are defined as having the same structure and the same values at corresponding nodes. If both trees are None, they are considered similar.
  class TreeNode:
      def __init__(self, x):
          self.val = x
          self.left = None
          self.right = None
  
  def are_similar(root1, root2):
      if root1 is None and root2 is None:
          return True
      if root1 is None or root2 is None:
          return False
      if root1.val != root2.val:
          return False
      return are_similar(root1.left, root2.left) and are_similar(root1.right, root2.right)
  
  assert are_similar(None, None)==True
  assert are_similar(TreeNode(1), TreeNode(2))==False
  assert are_similar(TreeNode(1), TreeNode(1))==True
  
  node1 = TreeNode(1)
  node2 = TreeNode(2)
  node3 = TreeNode(3)
  node1.left = node2
  node1.right = node3
  node4 = TreeNode(1)
  node5 = TreeNode(2)
  node6 = TreeNode(3)
  node4.left = node5
  node4.right = node6
  assert are_similar(node1, node4)==True
  
  node7 = TreeNode(1)
  node8 = TreeNode(2)
  node9 = TreeNode(4)
  node7.left = node8
  node7.right = node9
  assert are_similar(node1, node7)==False
output: def are_similar(root1, root2):
      if root1 is None and root2 is None:
          return True
      if root1 is None or root2 is None:
          return False
      if root1.val != root2.val:
          return False
      return are_similar(root1.left, root2.left) and are_similar(root1.right, root2.right)