def _Dynamic_Next(self, next_request, query_result):
    app = next_request.cursor().app()
    CheckAppId(self._trusted, self._app_id, app)

    cursor = self._query_cursors.get(next_request.cursor().cursor())
    Check(cursor and cursor.app == app,
          'Cursor %d not found' % next_request.cursor().cursor())

    count = next_request.count() if next_request.has_count() else None
    offset = next_request.offset() if next_request.has_offset() else None
    cursor.PopulateQueryResult(query_result,
                               count,
                               offset,
                               next_request.compile(),
                               first_result=False)

    if not query_result.has_cursor():
      del self._query_cursors[next_request.cursor().cursor()]
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_stub_util.py/DatastoreStub._Dynamic_Next/original