keras/src/trainers/data_adapters/py_dataset_adapter.py/OrderedEnqueuer/_wait_queue
class OrderedEnqueuer:    def _wait_queue(self):
        """Wait for the queue to be empty."""
        while True:
            time.sleep(0.1)
            if self.queue.unfinished_tasks == 0 or self.stop_signal.is_set():
                return