def cfg2dict(cfg):
 d = {}
 for section in cfg.sections():
  d[section] = dict(cfg.items(section))
 return d

def cfg2dict ( cfg ) : d = { } for section in cfg . sections ( ) : d [ section ] = dict ( cfg . items ( section ) ) return d
turn a configparser into a nested dict because configparser objects are dumb .