def METHOD_NAME(self):
    if not self.alive:
        if self.server_alive:
            if hasattr(self, 'server'):
                try:
                    self.server.stop()
                except Exception:
                    pass
            self.server_alive = False
        else:
            if TORNADO5:
                for callback in self.callbacks:
                    callback.stop()
                self.ioloop.stop()
            else:
                if not self.ioloop._callbacks:
                    self.ioloop.stop()