input: 
  class TreeNode:
      def __init__(self, x):
          self.val = x
          self.left = None
          self.right = None
  
  def are_similar(root1, root2):
      """ Check if two binary trees are similar. Similarity is defined by having
      the same structure (i.e., same number of nodes and same arrangement) and
      the same value in each corresponding node.
      >>> tree1 = TreeNode(1)
      >>> tree1.left = TreeNode(2)
      >>> tree1.right = TreeNode(3)
      >>> tree2 = TreeNode(1)
      >>> tree2.left = TreeNode(2)
      >>> tree2.right = TreeNode(3)
      >>> are_similar(tree1, tree2)
      True
      >>> tree3 = TreeNode(1)
      >>> tree3.left = TreeNode(2)
      >>> tree3.right = TreeNode(4)
      >>> are_similar(tree1, tree3)
      False
      """
      if root1 is None and root2 is None:
          return True
      if root1 is None or root2 is None:
          return False
      return (root1.val == root2.val and 
              are_similar(root1.left, root2.left) and 
              are_similar(root1.right, root2.right))
  
output:     if root1 is None and root2 is None:
          return True
      if root1 is None or root2 is None:
          return False
      return (root1.val == root2.val and 
              are_similar(root1.left, root2.left) and 
              are_similar(root1.right, root2.right))