def METHOD_NAME(responder, in_q, out_q, finished):
    while not finished.is_set():
        try:
            # NOTE: use nowait() so our loop is hot & can shutdown ASAP
            # if finished gets set.
            stream = in_q.get_nowait()
            for response in r.submit(stream):
                out_q.put_nowait(response)
        except Empty:
            pass