import queue


def queue_to_list(q):
    """
    Get all the values in a :class:`queue.Queue` object and return a list.
    """
    l = []
    while True:
        try:
            l.append(q.get_nowait())
        except queue.Empty:
            return l