def to_thread(func): @wraps(func) def inner(*args, **kwargs): queue.put((func, args, kwargs)) return inner