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]:
      """
      Given a Huffman tree, remove all its leaf nodes.
      
      >>> head = TreeNode(1)
      >>> head.left = TreeNode(2)
      >>> head.right = TreeNode(3)
      >>> head.left.left = TreeNode(4)
      >>> head.left.right = TreeNode(5)
      >>> head.right.left = TreeNode(6)
      >>> head.right.right = TreeNode(7)
      >>> result = dropLeafNodes(head)
      >>> print((result.value, result.left.value, result.right.value))
      (1, 2, 3)
      >>> print((result.left.left, result.left.right, result.right.left, result.right.right))
      (None, None, None, None)
      """
      if head is None or (not head.left and not head.right):
          return None
      head.left = dropLeafNodes(head.left)
      head.right = dropLeafNodes(head.right)
      return head
output:     if head is None or (not head.left and not head.right):
          return None
      head.left = dropLeafNodes(head.left)
      head.right = dropLeafNodes(head.right)
      return head