human
Complete this python program:
def _inlineCallbacks(result, g, deferred):
assistant
#Here is the Python program you requested.

    """See L{inlineCallbacks}.
    """
    waiting = [True, None]
    while 1:
        try:
            isFailure = isinstance(result, failure.Failure)
            if isFailure:
                result = result.throwExceptionIntoGenerator(g)
            else:
                result = g.send(result)
        except StopIteration:
            deferred.callback(None)
            return deferred
        except _DefGen_Return as e:
            appCodeTrace = exc_info()[2].tb_next
            if isFailure:
                appCodeTrace = appCodeTrace.tb_next
            if appCodeTrace.tb_next.tb_next:
                ultimateTrace = appCodeTrace
                while ultimateTrace.tb_next.tb_next:
                    ultimateTrace = ultimateTrace.tb_next
                filename = ultimateTrace.tb_frame.f_code.co_filename
                lineno = ultimateTrace.tb_lineno
                warnings.warn_explicit(('returnValue()    in    %r    causing    %r    to    exit:    returnValue    should    only    be    invoked    by    functions    decorated    with    inlineCallbacks' % (ultimateTrace.tb_frame.f_code.co_name, appCodeTrace.tb_frame.f_code.co_name)), DeprecationWarning, filename, lineno)
            deferred.callback(e.value)
            return deferred
        except:
            deferred.errback()
            return deferred
        if isinstance(result, Deferred):
            def gotResult(r):
                if waiting[0]:
                    waiting[0] = False
                    waiting[1] = r
                else:
                    _inlineCallbacks(r, g, deferred)
            result.addBoth(gotResult)
            if waiting[0]:
                waiting[0] = False
                return deferred
            result = waiting[1]
            waiting[0] = True
            waiting[1] = None
    return deferred