'Perform one unit of work for this task, retrieving one item from its
iterator, stopping if there are no further items in the iterator, and
pausing if the result was a L{defer.Deferred}.'

def _oneWorkUnit(self):

    try:
        result = next(self._iterator)
    except StopIteration:
        self._completeWith(TaskDone(), self._iterator)
    except:
        self._completeWith(TaskFailed(), Failure())
    else:
        if isinstance(result, defer.Deferred):
            self.pause()
            def failLater(f):
                self._completeWith(TaskFailed(), f)
            result.addCallbacks((lambda result: self.resume()), failLater)
