human
I wrote the below code

    from twisted.internet import reactor
    d = defer.Deferred()
    def go(last):
        try:
            r = next(i)
        except StopIteration:
            d.callback(last)
        except:
            d.errback()
        else:
            if isinstance(r, defer.Deferred):
                r.addCallback(go)
            else:
                reactor.callLater(0, go, r)
    go(None)
    return d

What's a good function header?
assistant
#Here's a good function header.

def iterateInReactor(i):