def _syncify_wrap(t, method_name):
    method = getattr(t, method_name)

    @functools.wraps(method)
    def syncified(*args, **kwargs):
        coro = method(*args, **kwargs)
        loop = asyncio.get_event_loop()
        if loop.is_running():
            return coro
        else:
            return loop.run_until_complete(coro)
    setattr(syncified, '__tl.sync', method)
    setattr(t, method_name, syncified)
def _syncify_wrap(t, method_name):
    method = getattr(t, method_name)

    @functools.wraps(method)
    def syncified(*args, **kwargs):
        coro = method(*args, **kwargs)
        loop = asyncio.get_event_loop()
        if loop.is_running():
            return coro
        else:
            return loop.run_until_complete(coro)
    setattr(syncified, '__tl.sync', method)
    setattr(t, method_name, syncified)