'Returns a list of bucket sets.'

def bucket_candidates(self, buckets, sufficient_funds):

    candidates = set()
    for (n, bucket) in enumerate(buckets):
        if sufficient_funds([bucket]):
            candidates.add((n,))
    attempts = min(100, (((len(buckets) - 1) * 10) + 1))
    permutation = range(len(buckets))
    for i in range(attempts):
        self.p.shuffle(permutation)
        bkts = []
        for (count, index) in enumerate(permutation):
            bkts.append(buckets[index])
            if sufficient_funds(bkts):
                candidates.add(tuple(sorted(permutation[:(count + 1)])))
                break
        else:
            raise NotEnoughFunds()
    candidates = [[buckets[n] for n in c] for c in candidates]
    return [strip_unneeded(c, sufficient_funds) for c in candidates]
