def bf(items, targets, **kwargs):
    """Best-Fit

    Complexity O(n^2)
    """
    bins = [(target, []) for target in targets]
    skip = []

    for item in items:
        containers = []
        capacities = []
        for target, content in bins:
            capacity = target - sum(content)
            if item <= capacity:
                containers.append(content)
                capacities.append(capacity - item)

        if len(capacities):
            weighted = zip(containers, weight(capacities, **kwargs))
            content, _ = min(weighted, key=operator.itemgetter(1))
            content.append(item)
        else:
            skip.append(item)
    return bins, skip
Best-Fit

    Complexity O(n^2)