def conforms(candidate, minsize, forgive):
    """
    Check if partition `candidate` is at most `forgive` additions from making
    all its elements conform to having minimum size `minsize`
    """
    deficit = 0
    for p in candidate:
        need = minsize - len(p)
        if need > 0:
            deficit += need

    # Is the deficit small enough?
    return (deficit <= forgive)

    Check if partition `candidate` is at most `forgive` additions from making
    all its elements conform to having minimum size `minsize`
    
bench/set_partition/set_partition.py