This function is duplicated as an instance method in `AIReschedulingTest`.  I'd suggest removing the function and replacing `_is_empty_generator` with `self._is_empty_generator` in the tests.