human
Complete this python program:
def inthread(func):
assistant
#Here is the Python code you requested.

    """Decorator to call a function in a thread and return a deferred with the
    result
    """
    @wraps(func)
    def wrapped(*a, **kw):
        return threads.deferToThread(func, *a, **kw)
    return wrapped