def run_task ( func ) : def _wrapped ( * a , * * k ) : loop = asyncio . get_event_loop ( ) return loop . run_until_complete ( func ( * a , * * k ) ) return _wrapped
python async function as paremeter
Decorator to wrap an async function in an event loop . Use for main sync interface methods .
def run_task(func):
    """
    Decorator to wrap an async function in an event loop.
    Use for main sync interface methods.
    """

    def _wrapped(*a, **k):
        loop = asyncio.get_event_loop()
        return loop.run_until_complete(func(*a, **k))

    return _wrapped