code: def try_next(self):
          
          # Attempt to get the next change with at most one getMore and at most
          # one resume attempt.
          try:
              change = self._cursor._try_next(True)
          except ConnectionFailure:
              self._resume()
              change = self._cursor._try_next(False)
          except OperationFailure as exc:
              if exc.code in _NON_RESUMABLE_GETMORE_ERRORS:
                  raise
              self._resume()
              change = self._cursor._try_next(False)
  
          # No changes are available.
          if change is None:
              return None
  
          try:
              resume_token = change['_id']
          except KeyError:
              self.close()
              raise InvalidOperation(
                  "Cannot provide resume functionality when the resume "
                  "token is missing.")
          self._resume_token = copy.copy(resume_token)
          self._start_at_operation_time = None
  
          if self._decode_custom:
              return _bson_to_dict(change.raw, self._orig_codec_options)
          return change
docs: Advance the cursor without blocking indefinitely.
  
          This method returns the next change document without waiting
          indefinitely for the next change. For example::
  
              with db.collection.watch() as stream:
                  while stream.alive:
                      change = stream.try_next()
                      if change is not None:
                          print(change)
                      elif stream.alive:
                          # We end up here when there are no recent changes.
                          # Sleep for a while to avoid flooding the server with
                          # getMore requests when no changes are available.
                          time.sleep(10)
  
          If no change document is cached locally then this method runs a single
          getMore command. If the getMore yields any documents, the next
          document is returned, otherwise, if the getMore returns no documents
          (because there have been no changes) then ``None`` is returned.
  
          :Returns:
            The next change document or ``None`` when no document is available
            after running a single getMore or when the cursor is closed.
  
          .. versionadded:: 3.8