def process_chain_both(callbacks, errbacks, input, *a, **kw):
 d = defer.Deferred()
 for (cb, eb) in zip(callbacks, errbacks):
  d.addCallbacks(cb, eb, callbackArgs=a, callbackKeywords=kw, errbackArgs=a, errbackKeywords=kw)
 if isinstance(input, failure.Failure):
  d.errback(input)
 else:
  d.callback(input)
 return d

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