input: from typing import Optional
  
  class TreeNode:
      def __init__(self):
          self.left = None
          self.right = None
  
  def dropLeafNodes(head: Optional[TreeNode]) -> Optional[TreeNode]:
      """
      Takes a Huffman tree and drops all its leaf nodes, returning the modified tree.
      
      >>> head = TreeNode()  # Creating a sample tree manually
      >>> head.left = TreeNode()
      >>> head.right = TreeNode()
      >>> head.left.left = TreeNode()
      >>> head.left.right = TreeNode()
      >>> head.right.left = TreeNode()
      >>> head.right.right = TreeNode()
      >>> result = dropLeafNodes(head)
      >>> result.left.left is None and result.left.right is None and result.right.left is None and result.right.right is None
      True
      """
      if head and not head.left and not head.right: 
          return None
    
      if not head: 
          return None
    
      head.left = dropLeafNodes(head.left) 
      head.right = dropLeafNodes(head.right) 
    
      return head
output:     if head and not head.left and not head.right: 
          return None
    
      if not head: 
          return None
    
      head.left = dropLeafNodes(head.left) 
      head.right = dropLeafNodes(head.right) 
    
      return head