code: def replication_state(self, repl_id):
          
          if "scheduler" in self.client.features():
              try:
                  repl_doc = Scheduler(self.client).get_doc(repl_id)
              except HTTPError as err:
                  raise CloudantReplicatorException(err.response.status_code, repl_id)
              state = repl_doc['state']
          else:
              try:
                  repl_doc = self.database[repl_id]
              except KeyError:
                  raise CloudantReplicatorException(404, repl_id)
              repl_doc.fetch()
              state = repl_doc.get('_replication_state')
          return state
docs: Retrieves the state for the given replication. Possible values are
          ``triggered``, ``completed``, ``error``, and ``None`` (meaning not yet
          triggered).
  
          :param str repl_id: Replication id used to identify the replication to
              inspect.
  
          :returns: Replication state as a ``str``