def _sample(population, k, replace=False):
    return population.reduction(partial(_sample_map_partitions, k=k, replace=replace), partial(_sample_reduce, k=k, replace=replace), out_type=Bag)
def _sample(population, k, replace=False):
    return population.reduction(partial(_sample_map_partitions, k=k, replace=replace), partial(_sample_reduce, k=k, replace=replace), out_type=Bag)