def ReadConfig(config_file="/etc/agentredrabbit.conf"):
    """
    Method provides way to read a config file and return a dictionary of
    config keys and its values
    @param config_file: Filesystem path of the config file. Defaults to
    /etc/agentredrabbit.conf
    """
    global config_fields
    config = ConfigParser()
    section = "agentredrabbit"
    if os.path.exists(config_file):
        try:
            with open(config_file, 'r') as cfg:
                config.readfp(cfg)
        except __HOLE__, e:
            log.error("Error: config_file not found " + str(e))
    else:
        config.add_section(section)
        for key in config_fields.keys():
            config.set(section, key, config_fields[key])
        try:
            with open(config_file, 'w') as cfg:
                config.write(cfg)
        except IOError:
            pass

    cfg = {}
    for key in config_fields.keys():
        try:
            cfg[key] = config.get(section, key)
        except Exception:
            cfg[key] = config_fields[key]
    return cfg
dataset/ETHPy150Open wingify/agentredrabbit/agentredrabbit/config.py/ReadConfig