def inthread(func):
    @wraps(func)
    def wrapped(*a, **kw):
        return threads.deferToThread(func, *a, **kw)
    return wrapped
Decorator to call a function in a thread and return a deferred with the
dataset/ETHPy150Open wcong/ants/ants/utils/decorator.py/inthread