def blockedSample(sampler, sample_size, predicates, *args) :
    
    blocked_sample = set()
    remaining_sample = sample_size - len(blocked_sample)
    previous_sample_size = 0

    while remaining_sample and predicates :
        random.shuffle(predicates)

        new_sample = sampler(remaining_sample, 
                             predicates,
                             *args)

        filtered_sample = (subsample for subsample 
                           in new_sample if subsample)

        blocked_sample.update(itertools.chain.from_iterable(filtered_sample))

        growth = len(blocked_sample) - previous_sample_size
        growth_rate = growth/remaining_sample

        remaining_sample = sample_size - len(blocked_sample)
        previous_sample_size = len(blocked_sample)

        if growth_rate < 0.001 :
            warnings.warn("%s blocked samples were requested, "
                          "but only able to sample %s"
                          % (sample_size, len(blocked_sample)))
            break

            
        predicates = [pred for pred, pred_sample 
                      in zip(predicates, new_sample)
                      if pred_sample or pred_sample is None]
        
    return blocked_sample
dataset/ETHPy150Open datamade/dedupe/dedupe/sampling.py/blockedSample/original