keras/src/legacy/preprocessing/image.py/Iterator/__next__
class Iterator:    def __next__(self):
        with self.lock:
            index_array = next(self.index_generator)
        # The transformation of images is not under thread lock
        # so it can be done in parallel
        return self._get_batches_of_transformed_samples(index_array)