async def METHOD_NAME(func, *args, **kwargs):
    """
    Run blocking code in a different thread and wait
    for the result. Support cancellation.
    :param func: Run this function in a different thread
    :param args: Parameters of the function
    :param kwargs: Keyword parameters of the function
    :returns: Return the result of the function
    """
    stopped_event = threading.Event()
    kwargs['stopped_event'] = stopped_event
    try:
        await wait_run_in_executor(func, *args, **kwargs)
    except asyncio.CancelledError:
        stopped_event.set()