import threading


def inthread(f, *args, **kwargs):
    """A convenience function for starting a Python thread.
    
    This function launches a Python thread in Daemon mode, and returns a 
    reference to the running thread object.
    
    Arguments:
        f: A reference to the target function to be executed in the Python thread.
        
        *args: Any arguments to pass to :code:`f` when it is executed in the 
               new thread.
        
        **kwargs: Any keyword arguments to pass to :code:`f` when it is executed
                  in the new thread.
                  
    Returns:
        A reference to the (already running) Python thread object
    """
    thread = threading.Thread(target=f, args=args, kwargs=kwargs)
    thread.daemon = True
    thread.start()
    return thread