input: Write a function to take a Huffman tree and drop all its leaf nodes. Implement the function in Python and test it with the given cases below.
  
  def dropLeafNodes(head): 
      
      # 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
  
  assert dropLeafNodes(None) == None
  
  # Input
  # (1)
  #    /      \
  #  (2)      (3)
  #  / \      / \
  # (4) (5)  (6) (7)
  
  # Output
  # (1)
  #    /      \
  #  (2)      (3)
  
  head_node = TreeNode(1)
  head_node.left = TreeNode(2)
  head_node.right = TreeNode(3)
  head_node.left.left = TreeNode(4)
  head_node.left.right = TreeNode(5)
  head_node.right.left = TreeNode(6)
  head_node.right.right = TreeNode(7)
  
  expected_output_node = TreeNode(1)
  expected_output_node.left = TreeNode(2)
  expected_output_node.right = TreeNode(3)
  
  assert dropLeafNodes(head_node) == expected_output_node
output: def dropLeafNodes(head): 
      
      # 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