<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def next_page(self, timeout=None, stream=None):
 """ Fetches the next page using the same parameters as the original query. Note that if streaming was used before, it will be used again unless overridden. :param stream: whether to enable streaming. `True` enables, `False` disables, `None` uses previous value. :type stream: boolean :param timeout: a timeout value in milliseconds, or 'infinity' :type timeout: int """

        if not self.continuation:
            raise ValueError("Cannot get next index page, no continuation")

        if stream is not None:
            self.stream = stream

        args = {'bucket': self.bucket,
                'index': self.index,
                'startkey': self.startkey,
                'endkey': self.endkey,
                'return_terms': self.return_terms,
                'max_results': self.max_results,
                'continuation': self.continuation,
                'timeout': timeout,
                'term_regex': self.term_regex}

        if self.stream:
            return self.client.stream_index(**args)
        else:
            return self.client.get_index(**args)