import configparser


def retrieve_config(arg_list, default_config):
    """ Retrieve a dictionary from a config file """

    if len(arg_list) > 1:
        config_file = arg_list[-1]
    else:
        config_file = default_config

    # Convert config file
    config = configparser.ConfigParser()
    config.read(config_file)
    
    return {s: dict(config.items(s)) for s in config.sections()}