@classmethod
def from_asyncio_future(cls, asyncio_f, loop=None):
    """
        Return a prompt_toolkit `Future` from the given asyncio Future.
        """
    f = cls(loop=loop)

    @asyncio_f.add_done_callback
    def _(asyncio_f):
        if asyncio_f.exception():
            f.set_exception(asyncio_f.exception())
        else:
            f.set_result(asyncio_f.result())
    return f
