'Returns a SearchResults populated from a search_service response pb.'

def _NewSearchResults(self, response, cursor):

    results = []
    for result_pb in response.result_list():
        per_result_cursor = None
        if result_pb.has_cursor():
            if isinstance(cursor, Cursor):
                per_result_cursor = Cursor(web_safe_string=_ToWebSafeString(cursor.per_result, _DecodeUTF8(result_pb.cursor())))
        results.append(self._NewScoredDocumentFromPb(result_pb.document(), result_pb.score_list(), result_pb.expression_list(), per_result_cursor))
    results_cursor = None
    if response.has_cursor():
        if isinstance(cursor, Cursor):
            results_cursor = Cursor(web_safe_string=_ToWebSafeString(cursor.per_result, _DecodeUTF8(response.cursor())))
    facets = []
    for facet_result in response.facet_result_list():
        facets.append(self._NewFacetResultFromPb(facet_result))
    return SearchResults(results=results, number_found=response.matched_count(), cursor=results_cursor, facets=facets)
