def deferredGenerator(f):
 def unwindGenerator(*args, **kwargs):
  return _deferGenerator(f(*args, **kwargs), Deferred())
 return mergeFunctionMetadata(f, unwindGenerator)

def deferredGenerator ( f ) : def unwindGenerator ( * args , ** kwargs ) : return _deferGenerator ( f ( * args , ** kwargs ) , Deferred ( ) ) return mergeFunctionMetadata ( f , unwindGenerator )
l{deferredgenerator} and l{waitfordeferred} help you write l{deferred}-using code that looks like a regular sequential function .