@classmethod
def combine(cls, left, right):
    """
        Combine two nodes according to Huffman's tree-building algorithm. The
        weight of the left node should be <= that of the right node. If weights
        are equal, left should be the node that was in the queue longer. This
        creates a new node and sets it as the parent attribute of each child.

        :param left:    child node on the left, should have weight <= right
        :type  left:    rhsm.huffman.HuffmanNode
        :param right:   child node on the right, should have weight >= left
        :type  right:   rhsm.huffman.HuffmanNode

        :return:        new node that is the combination of left and right
        :rtype:         rhsm.huffman.HuffmanNode
        """
    node = cls(left.weight + right.weight, None, left, right)
    left.parent = node
    right.parent = node
    return node
