input: 
  from typing import Optional
  
  class Node: 
      def __init__(self, data): 
          self.data = data 
          self.left = None
          self.right = None
  
  def is_subtree(T: Optional[Node], S: Optional[Node]) -> bool:
      """
      Check if the binary tree S is a subtree of binary tree T
      
      >>> is_subtree(None, None)
      True
      >>> is_subtree(Node(1), None)
      True
      >>> is_subtree(None, Node(1))
      False
      >>> T = Node(1); T.left = Node(2); T.right = Node(3)
      >>> S = Node(1); S.left = Node(2); S.right = Node(3)
      >>> is_subtree(T, S)
      True
      >>> T = Node(1); T.left = Node(2); T.right = Node(4)
      >>> S = Node(1); S.left = Node(2); S.right = Node(3)
      >>> is_subtree(T, S)
      False
      """
      if S is None: 
          return True
      if T is None: 
          return False
      if are_identical(T, S): 
          return True
      return is_subtree(T.left, S) or is_subtree(T.right, S)
  
  def are_identical(T: Optional[Node], S: Optional[Node]) -> bool: 
      if T is None and S is None: 
          return True
      if T is None or S is None: 
          return False
      return T.data == S.data and are_identical(T.left, S.left) and are_identical(T.right, S.right)
  
output:     if S is None: 
          return True
      if T is None: 
          return False
      if are_identical(T, S): 
          return True
      return is_subtree(T.left, S) or is_subtree(T.right, S)
  
  def are_identical(T: Optional[Node], S: Optional[Node]) -> bool: 
      if T is None and S is None: 
          return True
      if T is None or S is None: 
          return False
      return T.data == S.data and are_identical(T.left, S.left) and are_identical(T.right, S.right)