input: Write a function to compare two binary trees to check if they are similar. If both trees are identical in structure and values at each node, return True, else return False. If both trees are empty, return True.
  
  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), None)==False
  assert are_similar(TreeNode(1), TreeNode(1))==True
  node1 = TreeNode(1)
  node1.left = TreeNode(2)
  node1.right = TreeNode(3)
  node2 = TreeNode(1)
  node2.left = TreeNode(2)
  node2.right = TreeNode(3)
  assert are_similar(node1, node2)==True
  node3 = TreeNode(1)
  node3.left = TreeNode(3)
  node3.right = TreeNode(2)
  assert are_similar(node1, node3)==False
  node4 = TreeNode(1)
  node4.left = TreeNode(2)
  node4.right = TreeNode(4)
  assert are_similar(node1, node4)==False
  node5 = TreeNode(1)
  node5.left = TreeNode(2)
  assert are_similar(node1, node5)==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)