code: def _refresh(self):
          
          if len(self.__data) or self.__killed:
              return len(self.__data)
  
          if not self.__session:
              self.__session = self.__collection.database.client._ensure_session()
  
          if self.__id is None:  # Query
              if (self.__min or self.__max) and not self.__hint:
                  warnings.warn("using a min/max query operator without "
                                "specifying a Cursor.hint is deprecated. A "
                                "hint will be required when using min/max in "
                                "PyMongo 4.0",
                                DeprecationWarning, stacklevel=3)
              q = self._query_class(self.__query_flags,
                                    self.__collection.database.name,
                                    self.__collection.name,
                                    self.__skip,
                                    self.__query_spec(),
                                    self.__projection,
                                    self.__codec_options,
                                    self._read_preference(),
                                    self.__limit,
                                    self.__batch_size,
                                    self.__read_concern,
                                    self.__collation,
                                    self.__session,
                                    self.__collection.database.client)
              self.__send_message(q)
          elif self.__id:  # Get More
              if self.__limit:
                  limit = self.__limit - self.__retrieved
                  if self.__batch_size:
                      limit = min(limit, self.__batch_size)
              else:
                  limit = self.__batch_size
  
              # Exhaust cursors don't send getMore messages.
              g = self._getmore_class(self.__collection.database.name,
                                      self.__collection.name,
                                      limit,
                                      self.__id,
                                      self.__codec_options,
                                      self._read_preference(),
                                      self.__session,
                                      self.__collection.database.client,
                                      self.__max_await_time_ms,
                                      self.__exhaust_mgr)
              self.__send_message(g)
  
          return len(self.__data)
docs: Refreshes the cursor with more data from Mongo.
  
          Returns the length of self.__data after refresh. Will exit early if
          self.__data is already non-empty. Raises OperationFailure when the
          cursor cannot be refreshed due to an error on the query.