def _auth_return_future(f):
 replacer = ArgReplacer(f, 'callback')
 @functools.wraps(f)
 def wrapper(*args, **kwargs):
  future = TracebackFuture()
  (callback, args, kwargs) = replacer.replace(future, args, kwargs)
  if (callback is not None):
   future.add_done_callback(functools.partial(_auth_future_to_callback, callback))
  f(*args, **kwargs)
  return future
 return wrapper

def _auth_return_future ( f ) : replacer = ArgReplacer ( f , 'callback' ) @ functools . wraps ( f ) def wrapper ( * args , ** kwargs ) : future = TracebackFuture ( ) ( callback , args , kwargs ) = replacer . replace ( future , args , kwargs ) if ( callback is not None ) : future . add_done_callback ( functools . partial ( _auth_future_to_callback , callback ) ) f ( * args , ** kwargs ) return future return wrapper
similar to tornado .