code: def pid(sig):
      '''
      Return the PID or an empty string if the process is running or not.
      Pass a signature to use to find the process via ps.  Note you can pass
      a Python-compatible regular expression to return all pids of
      processes matching the regexp.
  
      .. versionchanged:: 2016.11.4
          Added support for AIX
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' status.pid <sig>
      '''
  
      cmd = __grains__['ps']
      output = __salt__['cmd.run_stdout'](cmd, python_shell=True)
  
      pids = ''
      for line in output.splitlines():
          if 'status.pid' in line:
              continue
          if re.search(sig, line):
              if pids:
                  pids += '\n'
              pids += line.split()[1]
  
      return pidf pid(sig):
      '''
      Return the PID or an empty string if the process is running or not.
      Pass a signature to use to find the process via ps.  Note you can pass
      a Python-compatible regular expression to return all pids of
      processes matching the regexp.
  
      .. versionchanged:: 2016.11.4
          Added support for AIX
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' status.pid <sig>
      '''
  
      cmd = __grains__['ps']
      output = __salt__['cmd.run_stdout'](cmd, python_shell=True)
  
      pids = ''
      for line in output.splitlines():
          if 'status.pid' in line:
              continue
          if re.search(sig, line):
              if pids:
                  pids += '\n'
              pids += line.split()[1]
  
      return pids
docs: Return the PID or an empty string if the process is running or not.
      Pass a signature to use to find the process via ps.  Note you can pass
      a Python-compatible regular expression to return all pids of
      processes matching the regexp.
  
      .. versionchanged:: 2016.11.4
          Added support for AIX
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' status.pid <sig>