input: Write a function to compare two binary trees to check if they are similar. If the two trees are similar, the function should return True; otherwise, it should return False. The function should handle cases where either or both trees are empty by returning True if both are empty or False if one of the trees is empty while the other is not.
  assert are_similar(None, None)==True
  assert are_similar(TreeNode(1), None)==False
  assert are_similar(None, TreeNode(1))==False
  assert are_similar(TreeNode(1), TreeNode(1))==True
  assert are_similar(TreeNode(1, TreeNode(2), TreeNode(3)), TreeNode(1, TreeNode(2), TreeNode(3)))==True
  assert are_similar(TreeNode(1, TreeNode(2), TreeNode(3)), TreeNode(1, TreeNode(3), TreeNode(2)))==False
output: def are_similar(tree1, tree2):
      if tree1 is None and tree2 is None:
          return True
      if tree1 is None or tree2 is None:
          return False
      if tree1.val != tree2.val:
          return False
      return are_similar(tree1.left, tree2.left) and are_similar(tree1.right, tree2.right)