'Initializer.
Args:
web_safe_string: The cursor string returned from the search service to
be interpreted by the search service to get the next set of results.
per_result: A bool when true will return a cursor per ScoredDocument in
SearchResults, otherwise will return a single cursor for the whole
SearchResults. If using offset this is ignored, as the user is
responsible for calculating a next offset if any.
Raises:
ValueError: if the web_safe_string is not of required format.'

def __init__(self, web_safe_string=None, per_result=False):

    self._web_safe_string = _CheckCursor(_ConvertToUnicode(web_safe_string))
    self._per_result = per_result
    if self._web_safe_string:
        parts = self._web_safe_string.split(':', 1)
        if ((len(parts) != 2) or (parts[0] not in ['True', 'False'])):
            raise ValueError(('invalid    format    for    web_safe_string,    got    %s' % self._web_safe_string))
        self._internal_cursor = parts[1]
        self._per_result = (parts[0] == 'True')
