code: def query_apsupsd_status():
      
      import subprocess
      output = {}
      try:
          apc_status = subprocess.check_output("/sbin/apcaccess")
      except:
          return None
      output['timestamp'] = time()
      for line in apc_status.split('\n'):
          (key, spl, val) = line.partition(': ')
          key = key.rstrip().upper()
          val = val.strip()
          val = val.split(' ')[0]
          if key == 'STATUS':
              output[key] = True if val.upper() == 'ONLINE' else False
          elif key in ['LINEV', 'BATTV', 'BCHARGE', 'TIMELEFT', 'LOADPCT']:
              output[key] = float(val)
  
      return output
docs: (100, 'STATUS'), # True/False
      (101, 'LINEV'), # Volts
      (102, 'BATTV'), # Volts
      (103, 'BCHARGE'), # %
      (104, 'TIMELEFT'), # Minutes
      (105, 'LOADPCT'), # %