def iterQueue(queue, sentinel):
    """Iterate over the values in queue until sentinel is reached."""
    while True:
        value = queue.get()
        if value != sentinel:
            yield value
        else:
            return
Iterate over the values in queue until sentinel is reached.
recipes/Python/252498_Generator_That_Helps_Simplify_Queue/recipe-252498.py