code: def shard_query_generator(self, query):
      '''A generator that queries each shard in sequence.'''
      shard_query = query.copy()
  
      for shard in self._stores:
        # yield all items matching within this shard
        cursor = shard.query(shard_query)
        for item in cursor:
          yield item
  
        # update query with results of first query
        shard_query.offset = max(shard_query.offset - cursor.skipped, 0)
        if shard_query.limit:
          shard_query.limit = max(shard_query.limit - cursor.returned, 0)
  
          if shard_query.limit <= 0:
            breaf shard_query_generator(self, query):
      '''A generator that queries each shard in sequence.'''
      shard_query = query.copy()
  
      for shard in self._stores:
        # yield all items matching within this shard
        cursor = shard.query(shard_query)
        for item in cursor:
          yield item
  
        # update query with results of first query
        shard_query.offset = max(shard_query.offset - cursor.skipped, 0)
        if shard_query.limit:
          shard_query.limit = max(shard_query.limit - cursor.returned, 0)
  
          if shard_query.limit <= 0:
            break
docs: A generator that queries each shard in sequence.