code: def remove_instance(self, instance):
          
          # External instances need to be close before (process + queues)
          if instance.is_external:
              logger.info("Request external process to stop for %s", instance.name)
              instance.stop_process()
              logger.info("External process stopped.")
  
          instance.clear_queues(self.daemon.sync_manager)
  
          # Then do not listen anymore about it
          self.instances.remove(instance)
docs: Request to cleanly remove the given instance.
          If instance is external also shutdown it cleanly
  
          :param instance: instance to remove
          :type instance: object
          :return: None