human
I wrote the below code

    if (steps is None):
        steps = repeat(0.1)
    steps = iter(steps)
    action = LOOP_UNTIL_ACTION(predicate=function)
    with action.context():
        d = DeferredContext(maybeDeferred(function))
    def loop(failure):
        if (expected and (not failure.check(*expected))):
            return failure
        try:
            interval = steps.next()
        except StopIteration:
            return failure
        d = deferLater(reactor, interval, action.run, function)
        d.addErrback(loop)
        return d
    d.addErrback(loop)
    def got_result(result):
        action.add_success_fields(result=result)
        return result
    d.addCallback(got_result)
    d.addActionFinish()
    return d.result

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

def retry_failure(reactor, function, expected=None, steps=None):