code: def wstatus_to_str(status):
      
      if os.WIFEXITED(status):
          return 'exited with return code %d' % (os.WEXITSTATUS(status),)
      if os.WIFSIGNALED(status):
          n = os.WTERMSIG(status)
          return 'exited due to signal %d (%s)' % (n, SIGNAL_BY_NUM.get(n))
      if os.WIFSTOPPED(status):
          n = os.WSTOPSIG(status)
          return 'stopped due to signal %d (%s)' % (n, SIGNAL_BY_NUM.get(n))
      return 'unknown wait status (%d)' % (status,)
docs: Parse and format a :func:`os.waitpid` exit status.