import queue


def dump_queue(q, i):
    """Helper to empty a queue into a list.

    :param q: A queue.Queue like object (e.g.
        multiprocessing.JoinableQueue)
    :param i: A list object, for which items from q will be appended to.

    :returns: i. While this isn't necessary, it's explicit.
    """
    while True:
        try:
            i.append(q.get_nowait())
        except queue.Empty:
            return i