code: def kill_after(seconds, timeout=2):
      
      pid = os.getpid()
      kill = os.kill
      run_after_async(seconds, kill, pid, signal.SIGTERM)
      run_after_async(seconds + timeout, kill, pid, 9)
docs: Kill self after seconds