'Perform the given query and return a list of entity_pb\'s.'

def _QueryForPbs(self, query):

    try:
        query_pb = query._ToPb(limit=self.batch_size, count=self.batch_size)
        result_pb = datastore_pb.QueryResult()
        apiproxy_stub_map.MakeSyncCall('datastore_v3', 'RunQuery', query_pb, result_pb)
        results = result_pb.result_list()
        while result_pb.more_results():
            next_pb = datastore_pb.NextRequest()
            next_pb.set_count((self.batch_size - len(results)))
            next_pb.mutable_cursor().CopyFrom(result_pb.cursor())
            result_pb = datastore_pb.QueryResult()
            apiproxy_stub_map.MakeSyncCall('datastore_v3', 'Next', next_pb, result_pb)
            results += result_pb.result_list()
        return results
    except apiproxy_errors.ApplicationError as e:
        raise datastore._ToDatastoreError(e)
