def _drive(iterable, finished):
    try:
        next = iterable.next()
    except StopIteration:
        finished.callback('')
    except:
        finished.errback()
    else:
        deferred, returner = next
        def cb(result):
            """
            Pass the result of a Deferred on to the callable which is
            waiting for it and then resume driving the iterable.

            No one has any business whatsoever being on the callback chain
            after this callback, so we can swallow the Deferred's result to
            ease the garbage collector's job and for consistency with C{eb}
            below.
            """
            returner(result)
            _drive(iterable, finished)

        def eb(failure):
            """
            Handle asynchronous failures in the iterable by passing them on
            to the outer Deferred.  The iterable will not be resumed by this
            driver any further.

            Like C{cb} above, we swallow this result intentionally.  The
            only thing that could reasonably happen to it were we to return
            it here is for it to be logged as an unhandled Deferred, since
            we are supposed to be the last errback on the chain.
            """
            finished.errback(failure)

        deferred.addCallback(cb).addErrback(eb)
Hook for specifying the name of the template to use for a given step.
dataset/ETHPy150Open twisted/nevow/nevow/flat/twist.py/_drive--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/formtools/wizard/legacy.py/FormWizard.get_template