def ensureDeferred(coro):
 from types import GeneratorType
 if (version_info >= (3, 4, 0)):
  from asyncio import iscoroutine
  if (iscoroutine(coro) or isinstance(coro, GeneratorType)):
   return _inlineCallbacks(None, coro, Deferred())
 elif (version_info >= (3, 3, 0)):
  if isinstance(coro, GeneratorType):
   return _inlineCallbacks(None, coro, Deferred())
 if (not isinstance(coro, Deferred)):
  raise ValueError(('%r is not a coroutine or a Deferred' % (coro,)))
 return coro

def ensureDeferred ( coro ) : from types import GeneratorType if ( version_info >= ( 3 , 4 , 0 ) ) : from asyncio import iscoroutine if ( iscoroutine ( coro ) or isinstance ( coro , GeneratorType ) ) : return _inlineCallbacks ( None , coro , Deferred ( ) ) elif ( version_info >= ( 3 , 3 , 0 ) ) : if isinstance ( coro , GeneratorType ) : return _inlineCallbacks ( None , coro , Deferred ( ) ) if ( not isinstance ( coro , Deferred ) ) : raise ValueError ( ( '%r is not a coroutine or a Deferred' % ( coro , ) ) ) return coro
schedule the execution of a coroutine that awaits/yields from l{deferred}s .