def _sample_map_partitions(population, k, replace):
    '\n    Map function used on the sample and choices functions.\n    Parameters\n    ----------\n    population : list\n        List of elements to sample.\n    k : int, optional\n        Number of elements to sample. Default is 1.\n\n    Returns\n    -------\n    sample: list\n        List of sampled elements from the partition.\n    lx: int\n        Number of elements on the partition.\n    k: int\n        Number of elements to sample.\n    '
    lx = len(population)
    real_k = (k if (k <= lx) else lx)
    sample_func = (rnd.choices if replace else rnd.sample)
    sampled = ([] if (real_k == 0) else sample_func(population=population, k=real_k))
    return (sampled, lx)
Map function used on the sample and choices functions.
Parameters
----------
population : list
    List of elements to sample.
k : int, optional
    Number of elements to sample. Default is 1.

Returns
-------
sample: list
    List of sampled elements from the partition.
lx: int
    Number of elements on the partition.
k: int
    Number of elements to sample.
def _sample_map_partitions(population, k, replace):
    '\n    Map function used on the sample and choices functions.\n    Parameters\n    ----------\n    population : list\n        List of elements to sample.\n    k : int, optional\n        Number of elements to sample. Default is 1.\n\n    Returns\n    -------\n    sample: list\n        List of sampled elements from the partition.\n    lx: int\n        Number of elements on the partition.\n    k: int\n        Number of elements to sample.\n    '
    lx = len(population)
    real_k = (k if (k <= lx) else lx)
    sample_func = (rnd.choices if replace else rnd.sample)
    sampled = ([] if (real_k == 0) else sample_func(population=population, k=real_k))
    return (sampled, lx)