input: from typing import List
  
  def are_similar(root1: TreeNode, root2: TreeNode) -> bool:
      """
      Given two binary trees, check if they are similar, meaning they have the same structure and node values.
  
      Example:
      >>> 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(2)
      >>> root4 = TreeNode(1)
      >>> root4.right = TreeNode(2)
      >>> are_similar(root3, root4)
      False
      """
output:     if not root1 and not root2:
          return True
      if not root1 or not root2:
          return False
      if root1.val != root2.val:
          return False
      return are_similar(root1.left, root2.left) and are_similar(root1.right, root2.right)