input: from typing import Optional
  
  class TreeNode:
      def __init__(self, value):
          self.value = value
          self.left = None
          self.right = None
  
  def dropLeafNodes(head: Optional[TreeNode]) -> Optional[TreeNode]:
      """
      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)
      >>> modified_tree = dropLeafNodes(root)
      >>> print(modified_tree.value, modified_tree.left.value, modified_tree.right.value)
      1 2 3
      """
      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