Return a future result using single event loop with decorated coroutine
<p>I have a decorator that decorate a coroutine function and assign the value returned by the coroutine to a future instance.</p>

<pre><code>import asyncio
import functools


def ensure_prepare(future):
    async def decorator(asyncfunc):
        @functools.wraps(asyncfunc)
        async def wrapper(*args, **kwargs):
            future.set_result(await asyncfunc(*args, **kwargs))
            return future
        return wrapper
    return decorator
</code></pre>

<p>Demo:</p>

<pre><code>&gt;&gt;&gt; future = asyncio.Future()
&gt;&gt;&gt; 
&gt;&gt;&gt; @ensure_prepare(future)
... async def check_sanity():
...     return 9
... 
&gt;&gt;&gt; loop = asyncio.get_event_loop()
&gt;&gt;&gt; loop.run_until_complete(check_sanity)
&lt;function check_sanity at 0x7f935300a158&gt;
&gt;&gt;&gt; _()
&lt;coroutine object check_sanity at 0x7f934f78a728&gt;
&gt;&gt;&gt; loop.run_until_complete(_)
&lt;Future finished result=9&gt;
&gt;&gt;&gt; _.result()
9
</code></pre>

<p>As you can see I need to run two times the event loop in order to get the future result. Is there any way to make the event loop return the value after the first run? I don't want to <em>await</em> in my code and assign the result(function) to a name.</p>