def band_select(bands):
    """
    Return image/mask pair where spectral bands in image have been selected as a list.

    Parameters
    ----------
    bands : list
        Spectral bands, defined with respect to input's final dimension.

    Returns
    -------
    apply_transform : func
        Transformation for image/mask pairs.
    """
    def apply_transform(img, mask):
        if bands is not None:
            img = img[..., bands]
        return img, mask
    return apply_transform