Make a readline-like function which peeks into the source.

def _make_readline_peeker(self):
        """Make a readline-like function which peeks into the source."""
        counter = itertools.count(0)
        def readline():
            try:
                return self._peek_buffer(next(counter))
            except StopIteration:
                return ''
        return readline