code: def mysql_to_dict(data, key):
      '''
      Convert MySQL-style output to a python dictionary
      '''
      ret = {}
      headers = ['']
      for line in data:
          if not line:
              continue
          if line.startswith('+'):
              continue
          comps = line.split('|')
          for comp in range(len(comps)):
              comps[comp] = comps[comp].strip()
          if len(headers) > 1:
              index = len(headers) - 1
              row = {}
              for field in range(index):
                  if field < 1:
                      continue
                  else:
                      row[headers[field]] = salt.utils.stringutils.to_num(comps[field])
              ret[row[key]] = row
          else:
              headers = comps
      return ref mysql_to_dict(data, key):
      '''
      Convert MySQL-style output to a python dictionary
      '''
      ret = {}
      headers = ['']
      for line in data:
          if not line:
              continue
          if line.startswith('+'):
              continue
          comps = line.split('|')
          for comp in range(len(comps)):
              comps[comp] = comps[comp].strip()
          if len(headers) > 1:
              index = len(headers) - 1
              row = {}
              for field in range(index):
                  if field < 1:
                      continue
                  else:
                      row[headers[field]] = salt.utils.stringutils.to_num(comps[field])
              ret[row[key]] = row
          else:
              headers = comps
      return ret
docs: Convert MySQL-style output to a python dictionary