def submit(
        self, func: Callable[P, Awaitable[R]], *args: P.args, **kwargs: P.kwargs
    ) -> duet.AwaitableFuture[R]:
        """Dispatch the given function to be run in an asyncio coroutine.

        Args:
            func: asyncio function which will be run in a separate thread.
                Will be called with *args and **kw and should return an asyncio
                awaitable.
            *args: Positional args to pass to func.
            **kwargs: Keyword args to pass to func.
        """
        future: concurrent.futures.Future = asyncio.run_coroutine_threadsafe(
            func(*args, **kwargs), self.loop  # type: ignore[arg-type]
        )
        return duet.AwaitableFuture.wrap(future)
Dispatch the given function to be run in an asyncio coroutine.

        Args:
            func: asyncio function which will be run in a separate thread.
                Will be called with *args and **kw and should return an asyncio
                awaitable.
            *args: Positional args to pass to func.
            **kwargs: Keyword args to pass to func.
        
cirq-google/cirq_google/engine/asyncio_executor.py