code: def repl_update(self, config):
          
          cfg = config.copy()
          cfg['version'] += 1
          try:
              result = self.run_command("replSetReconfig", cfg)
              if int(result.get('ok', 0)) != 1:
                  return False
          except pymongo.errors.AutoReconnect:
              self.update_server_map(cfg)  # use new server_map
          self.waiting_member_state()
          self.waiting_config_state()
          return self.connection() and True
docs: Reconfig Replicaset with new config