parameters: (coro, loop)
return_statement: return future
docstring: Submit a coroutine object to a given event loop.
  
      Return a concurrent.futures.Future to access the result.
docstring_summary: Submit a coroutine object to a given event loop.
docstring_tokens: Submit a coroutine object to a given event loop .
function: def run_coroutine_threadsafe(coro, loop):
      """Submit a coroutine object to a given event loop.
  
      Return a concurrent.futures.Future to access the result.
      """
      if not coroutines.iscoroutine(coro):
          raise TypeError('A coroutine object is required')
      future = concurrent.futures.Future()
  
      def callback():
          try:
              futures._chain_future(ensure_future(coro, loop=loop), future)
          except Exception as exc:
              if future.set_running_or_notify_cancel():
                  future.set_exception(exc)
              raise
  
      loop.call_soon_threadsafe(callback)
      return future
function_tokens: def run_coroutine_threadsafe ( coro , loop ) : if not coroutines . iscoroutine ( coro ) : raise TypeError ( 'A coroutine object is required' ) future = concurrent . futures . Future ( ) def callback ( ) : try : futures . _chain_future ( ensure_future ( coro , loop = loop ) , future ) except Exception as exc : if future . set_running_or_notify_cancel ( ) : future . set_exception ( exc ) raise loop . call_soon_threadsafe ( callback ) return future