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]:
      """
      Function to drop all leaf nodes from a given Huffman tree.
  
      >>> tree = TreeNode(1)
      >>> tree.left = TreeNode(2)
      >>> tree.right = TreeNode(3)
      >>> tree.left.left = TreeNode(4)
      >>> tree.left.right = TreeNode(5)
      >>> tree.right.left = TreeNode(6)
      >>> tree.right.right = TreeNode(7)
      >>> dropLeafNodes(tree)
      TreeNode(1)
      """
      if head is None:
          return None
      if head.left is None and head.right is None:
          return None
      head.left = dropLeafNodes(head.left)
      head.right = dropLeafNodes(head.right)
      return head
output:     if head is None:
          return None
      if head.left is None and head.right is None:
          return None
      head.left = dropLeafNodes(head.left)
      head.right = dropLeafNodes(head.right)
      return head