stop requester

def on_stop(self):
        """
        stop requester
        """
        LOGGER.debug("natsd.Requester.on_stop")
        self.is_started = False
        try:
            LOGGER.debug("natsd.Requester.on_stop - unsubscribe from " + str(self.responseQS))
            next(self.nc.unsubscribe(self.responseQS))
        except StopIteration as e:
            pass
        try:
            LOGGER.debug("natsd.Requester.on_stop - close nats connection")
            next(self.nc.close())
        except StopIteration as e:
            pass
        LOGGER.debug("natsd.Requester.on_stop - nc is closed: " + str(self.nc.is_closed))
        try:
            LOGGER.debug("natsd.Requester.on_stop - cancelling aio tasks loop")
            loop_to_stop = self.loop
            for task in asyncio.Task.all_tasks(loop_to_stop):
                LOGGER.debug("natsd.Requester.on_stop - cancelling task " + str(task))
                task.cancel()
            LOGGER.debug("natsd.Requester.on_stop - stopping aio loop stop")
            loop_to_stop.stop()
            count = 0
            while loop_to_stop.is_running():
                count += 1
                if count % 10 == 0:
                    LOGGER.debug("natsd.Requester.on_stop - waiting aio loop to be stopped (" +
                                 str(asyncio.Task.all_tasks(loop_to_stop).__len__()) + " tasks left; " +
                                 "current task: " + str(asyncio.Task.current_task(loop_to_stop)) + ")")
                    for task in asyncio.Task.all_tasks(loop_to_stop):
                        LOGGER.debug("natsd.Requester.on_stop - cancelling task " + str(task))
                        task.cancel()
                time.sleep(1)
                if count == 120:
                    LOGGER.error("natsd.Requester.on_stop - unable to stop aio loop after 120 sec (" +
                                 str(asyncio.Task.all_tasks(loop_to_stop).__len__()) + " tasks left; " +
                                 "current task: " + str(asyncio.Task.current_task(loop_to_stop)) + ")")
                    break
            if not loop_to_stop.is_running():
                LOGGER.debug("natsd.Requester.on_stop - close aio loop")
                loop_to_stop.close()
        except Exception as e:
            LOGGER.warn("natsd.Requester.on_stop - exception on aio clean : "
                        + traceback.format_exc())