code: def _psax(response, pattern=None):
      """strips out bad lines in 'ps ax' response
  
      Takes multi-line string, response from execute('ps ax') or execute('ps axj').
      Takes an optional regex pattern for finding 'good' lines.  If pattern
      is None, assumes 'ps ax' was called.
      """
      if not response:
          return response
      if pattern:
          response = (
              line
              for line in response.split("\n")
              if pattern.match(line)
          )
      else:  # a 'ps ax' line should start with a 'digit'; " PID THING ..."
          response = (
              line
              for line in response.split("\n")
              if line and line.lstrip()[0] in string.digits
          )
      return "\n".join(response)
  
file_path: pathos/pathos/core.py
imports: import os
  import string
  import re
  import pathos
label_desc: Use image node_id 4 for calling a global function with example usage: _psax(response, pattern) and returns: str, response