code: def _is_pid_running_on_windows(pid):
      
      pid = str(pid)
  
      # Hide flashing command prompt
      startupinfo = subprocess.STARTUPINFO()
      startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
  
      process = subprocess.Popen(r'tasklist /fi "PID eq {0}"'.format(pid),
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.STDOUT,
                                 startupinfo=startupinfo)
      stdoutdata, stderrdata = process.communicate()
      stdoutdata = to_text_string(stdoutdata)
      process.kill()
      check = pid in stdoutdata
  
      return check
docs: Check if a process is running on windows systems based on the pid.