def ensure_stopped(self):
        """Idempotent channel stop"""
        if not self.active:
            return self
        self.stop()
        self.observer.cancel()
        self._manager.remove_routes(self, self.get_routing_keys())
        self._active = False
        return self
Idempotent channel stop