helper for buffered_generator

def _buffered_generation_process(source_gen, buffer_, sentinal):
    """ helper for buffered_generator """
    for data in source_gen:
        buffer_.put(data, block=True)
    # sentinel: signal the end of the iterator
    buffer_.put(sentinal)
    # unfortunately this does not suffice as a signal: if buffer_.get() was
    # called and subsequently the buffer_ is closed, it will block forever.
    buffer_.close()