def _putResultInDeferred(reactor, deferred, f, args, kwargs):
 try:
  result = f(*args, **kwargs)
 except Exception:
  f = failure.Failure()
  reactor.callFromThread(deferred.errback, f)
 else:
  reactor.callFromThread(deferred.callback, result)

def _putResultInDeferred ( reactor , deferred , f , args , kwargs ) : try : result = f ( * args , ** kwargs ) except Exception : f = failure . Failure ( ) reactor . callFromThread ( deferred . errback , f ) else : reactor . callFromThread ( deferred . callback , result )
run a function and give results to a deferred .