import queue
import threading


def create_and_start_thread(target, thread_queue=False):
    """ Creates a new thread and starts it """
    if thread_queue:
        thread_queue = queue.Queue()
        thread = threading.Thread(target=target, kwargs={'thread_queue': thread_queue})
        thread.start()
        return thread, thread_queue
    else:
        thread = threading.Thread(target=target)
        thread.start()
        return thread