input: from typing import Optional
  
  class Node:
      def __init__(self, left=None, right=None):
          self.left = left
          self.right = right
  
  def dropLeafNodes(head: Optional[Node]) -> Optional[Node]: 
      """
      Given a Huffman tree, this function drops all its leaf nodes, leaving only internal nodes.
      >>> head = Node(Node(Node(), Node()), Node(Node(), Node()))
      >>> dropLeafNodes(head)
      Node(Node(), Node())
      """
      # If node is not None and doesn't have any children 
      if head and not head.left and not head.right: 
          return None
    
      # Don't change anything if head is None 
      if not head: 
          return None
    
      # Recursively call dropLeafNodes on left and right subtrees
      head.left = dropLeafNodes(head.left) 
      head.right = dropLeafNodes(head.right) 
    
      # Return head of the modified tree
      return head
output:     # If node is not None and doesn't have any children 
      if head and not head.left and not head.right: 
          return None
    
      # Don't change anything if head is None 
      if not head: 
          return None
    
      # Recursively call dropLeafNodes on left and right subtrees
      head.left = dropLeafNodes(head.left) 
      head.right = dropLeafNodes(head.right) 
    
      # Return head of the modified tree
      return head