input: from typing import Optional
  
  class TreeNode:
      def __init__(self, value):
          self.value = value
          self.left: Optional[TreeNode] = None
          self.right: Optional[TreeNode] = None
  
  def dropLeafNodes(head: Optional[TreeNode]) -> Optional[TreeNode]:
      """
      Function that takes a Huffman tree and drops all its leaf nodes.
      >>> root = TreeNode(1)
      >>> root.left = TreeNode(2)
      >>> root.right = TreeNode(3)
      >>> root.left.left = TreeNode(4)
      >>> root.left.right = TreeNode(5)
      >>> root.right.left = TreeNode(6)
      >>> root.right.right = TreeNode(7)
      >>> dropLeafNodes(root)
      TreeNode(1)
      """
      # 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