code: def stop_server(self):
          
          self.stop = True
          while self.task_count:
              time.sleep(END_RESP)
          self.terminate = True
docs: Stop receiving connections, wait for all tasks to end, and then 
          terminate the server.