code: def monitor(self, timeout):
          
  
          def check(self, timeout):
              time.sleep(timeout)
              self.stop()
          wather = threading.Thread(target=check)
          wather.setDaemon(True)
          wather.start()
docs: Monitor the process, check whether it runs out of time.