input: 
  def are_similar(root1, root2):
      """
      Function to compare two binary trees to check if they are similar.
      Two binary trees are considered similar if they have the same structure
      and corresponding nodes have the same value.
  
      >>> root1 = TreeNode(1)
      >>> root1.left = TreeNode(2)
      >>> root1.right = TreeNode(3)
      >>> root2 = TreeNode(1)
      >>> root2.left = TreeNode(2)
      >>> root2.right = TreeNode(3)
      >>> are_similar(root1, root2)
      True
  
      >>> root3 = TreeNode(1)
      >>> root3.left = TreeNode(4)
      >>> root3.right = TreeNode(2)
      >>> are_similar(root1, root3)
      False
  
      >>> root4 = TreeNode(1)
      >>> root4.left = TreeNode(2)
      >>> are_similar(root1, root4)
      False
      """
      if root1 is None and root2 is None:
          return True
      if (root1 is None) != (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)
  
output:     if root1 is None and root2 is None:
          return True
      if (root1 is None) != (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)