code: def kill_process(self):
          
          if self.process.poll() is not None:
              return
          try:
              if hasattr(self.process, 'terminate'):
                  self.process.terminate()
              elif os.name != 'nt':
                  os.kill(self.process.pid, 9)
              else:
                  import ctypes
                  handle = int(self.process._handle)
                  ctypes.windll.kernel32.TerminateProcess(handle, -1)
          except OSError:
              pass
docs: Stop the process