code: def follow_replication(self, repl_id):
          
          def update_state():
              """
              Retrieves the replication state.
              """
              if "scheduler" in self.client.features():
                  try:
                      arepl_doc = Scheduler(self.client).get_doc(repl_id)
                      return arepl_doc, arepl_doc['state']
                  except HTTPError:
                      return None, None
              else:
                  try:
                      arepl_doc = self.database[repl_id]
                      arepl_doc.fetch()
                      return arepl_doc, arepl_doc.get('_replication_state')
                  except KeyError:
                      return None, None
  
          while True:
              # Make sure we fetch the state up front, just in case it moves
              # too fast and we miss it in the changes feed.
              repl_doc, state = update_state()
              if repl_doc:
                  yield repl_doc
              if state is not None and state in ['error', 'completed']:
                  return
  
              # Now listen on changes feed for the state
              for change in self.database.changes():
                  if change.get('id') == repl_id:
                      repl_doc, state = update_state()
                      if repl_doc is not None:
                          yield repl_doc
                      if state is not None and state in ['error', 'completed']:
                          return
docs: Blocks and streams status of a given replication.
  
          For example:
  
          .. code-block:: python
  
              for doc in replicator.follow_replication(repl_doc_id):
                  # Process replication information as it comes in
  
          :param str repl_id: Replication id used to identify the replication to
              inspect.
  
          :returns: Iterable stream of copies of the replication Document
              and replication state as a ``str`` for the specified replication id