def __iter__(self) -> Iterator[int]:
        """
        Returns:
            indeces for sampling dataset elems during an epoch
        """
        inds = []

        for cls_id in random.sample(self._classes, self._num_epoch_classes):
            all_cls_inds = find_value_ids(self._labels, cls_id)

            # we've checked in __init__ that this value must be > 1
            num_samples_exists = len(all_cls_inds)

            if num_samples_exists < self._k:
                selected_inds = random.sample(
                    all_cls_inds, k=num_samples_exists
                ) + random.choices(all_cls_inds, k=self._k - num_samples_exists)
            else:
                selected_inds = random.sample(all_cls_inds, k=self._k)

            inds.extend(selected_inds)

        return iter(inds)

        Returns:
            indeces for sampling dataset elems during an epoch
        
catalyst/contrib/data/sampler.py