def os_is_running(pid):
 if isinstance(pid, six.string_types):
  pid = int(pid)
 if HAS_PSUTIL:
  return psutil.pid_exists(pid)
 else:
  try:
   os.kill(pid, 0)
   return True
  except OSError:
   return False

def os_is_running ( pid ) : if isinstance ( pid , six . string_types ) : pid = int ( pid ) if HAS_PSUTIL : return psutil . pid_exists ( pid ) else : try : os . kill ( pid , 0 ) return True except OSError : return False
use os facilities to determine if a process is running .