docstr: Spawn the pg_config executable, querying for the given config
  name, and return the printed value, sanitized. 
docstr_tok: ["Spawn","the","pg_config","executable",",","querying","for","the","given","config","name",",","and","return","the","printed","value",",","sanitized","."]
code: def query(self, attr_name, *, empty_ok=False):
      """Spawn the pg_config executable, querying for the given config
      name, and return the printed value, sanitized."""
      try:
          pg_config_process = subprocess.run(
              [self.pg_config_exe, "--" + attr_name],
              stdout=subprocess.PIPE,
              stderr=subprocess.PIPE,
          )
      except OSError:
          raise Warning(
              f"Unable to find 'pg_config' file in '{self.pg_config_exe}'"
          )
      if pg_config_process.returncode:
          err = pg_config_process.stderr.decode(
              errors="backslashreplace"
          )
          raise Warning(f"pg_config --{attr_name} failed: {err}")
      result = pg_config_process.stdout.decode().strip()
      if not result and not empty_ok:
          raise Warning(f"pg_config --{attr_name} is empty")
      return result
  
imports: import os
  import sys
  import re
  import subprocess
  from setuptools import setup, Extension
  from distutils.command.build_ext import build_ext
  from distutils.ccompiler import get_default_compiler
  from distutils.errors import CompileError
  import configparser
label_desc: Use image node_id 2 for calling the PostgresConfig obj's underlying member method code with example usage: obj.query(attr_name) and returns: result