human
Complete this python program:
def _wrap_generator_with_readonly(generator):
assistant
#Here is the Python code you requested.

    """We have to wrap generators specially.  Assume it performs
    the query on the first call to next().
    """
    def wrapper_generator(*args, **kwargs):
        generator_obj = generator(*args, **kwargs)
        readonly_connection.connection().set_django_connection()
        try:
            first_value = generator_obj.next()
        finally:
            readonly_connection.connection().unset_django_connection()
        (yield first_value)
        while True:
            (yield generator_obj.next())
    wrapper_generator.__name__ = generator.__name__
    return wrapper_generator