def METHOD_NAME(next):
    def handler(method, args):
        global middleware_called
        middleware_called = True
        if len(args) > 1 and sys.getsizeof(args[1]) > 1000000:
            print("{}({}) = ".format(method.__name__, len(args[1])), end="")
        else:
            print("{}({}) = ".format(method.__name__, args[1:]), end="")
        # ret is a <class 'coroutine'>
        ret = next(method, args)
        # Use asyncIO.ensure_future to convert the coroutine to a task
        task = asyncio.ensure_future(ret)
        # Register a callback on the future
        task.add_done_callback(log_future)
        return task
    return handler