import functools
import threading


def thread_it(func):
    """A wrapper function to run func in a daemon thread.

    Args:
        func (function): The function to run in a thread

    Returns:
        function: the wrapped function.
    """
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        thread = threading.Thread(target=func, args=args, kwargs=kwargs)
        thread.daemon = True
        thread.start()
        return thread #returning to support unit testing

    return wrapper