def packingHelper(prefix, prefixWeight, remainingWeights, L, H):
    """Helper function for recursively finding feasible packing.

    Args:

        prefix (list of int): list of integer weights that are already
            in the packing we are searching for

        prefixWeight (int): precomputed sum of the weights in prefix,
            passed as a parameter to prevent needless recomputation.

        remainingWeights (list of int): list of integer weights that
            are still available to be used in the packing we are
            searching for.

        L (int): the low threshold

        H (int): the high threshold

    Returns:

        list of int: A list P of integers that includes prefix and
            possibly some of remainingWeights, such that
            L<=sum(P)<=H. If no such list exists, None is returned.

    """

    if L <= prefixWeight and prefixWeight <= H:
        # We have found a feasible packing, so return it.
        return prefix
    elif len(remainingWeights) == 0:
        # There is no feasible packing with this prefix, so return
        # None.
        return None
    else:
        # We don't have a solution yet, so we will attempt two recursive
        # calls to packingHelper(): the first one will not use the next
        # weight and the second one will use the next weight.
        newWeights = remainingWeights[1:]
        nextWeight = remainingWeights[0]
        # 1. Recursive call *without* the next weight
        aPacking = packingHelper(prefix, prefixWeight, newWeights, L, H)
        if aPacking != None:
            return aPacking
        else:
            # 2. Recursive call *with* the next weight
            newPrefix = prefix + [nextWeight]  # extends list
            newPrefixWeight = prefixWeight + nextWeight  # adds numerical weights
            aPacking = packingHelper(newPrefix, newPrefixWeight, newWeights, L, H)
            return aPacking