#NEWLINE# def process_chain_both( callbacks , errbacks , input , * a , **kw ) : #NEWLINE# #INDENT# 'Return a Deferred built by chaining the given callbacks and errbacks' #NEWLINE# d = defer . Deferred ( ) #NEWLINE# for ( cb , eb ) in zip ( callbacks , errbacks ) : #NEWLINE# #INDENT# d . addCallbacks ( cb , eb , callbackArgs = a , callbackKeywords = kw , errbackArgs = a , errbackKeywords = kw ) #NEWLINE# #UNINDENT# if isinstance ( kw , failure . Failure ) : #NEWLINE# #INDENT# d . errback ( input ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# d . callback ( input ) #NEWLINE# #UNINDENT# return d