def slicer(shp, idxs, var=None):
    """Obtain a list of slicers to slice the data array according to the
    selected data

    Parameters
    ----------
    shp : tuple
        Data shape
    idxs : iterable
        Indexes of the selected data
    var : int, optional
        Data to be selected, in case of multidimensional sample, by default None

    Returns
    -------
    slice
        Slices of the data
    """

    # It is assumed that the first dimension is the samples
    slc = []
    # Iterate over the datasets
    for idx in idxs:
        idx.sort()
        if not var:
            slc += [tuple([idx] + [slice(None)] * (len(shp) - 1))]
        else:
            slc += [tuple([idx] + [slice(None)] * (len(shp) - 2) + [var])]
    return tuple(slc)