Search and load a configuration file.

def get_settings(config_file):
    """Search and load a configuration file."""
    default_settings = {
        'general': {
            'endpoint': 'http://guacamole.antojitos.io/files/',
            'shortener': 'http://t.antojitos.io/api/v1/urls',
        }
    }

    settings = configparser.ConfigParser()
    try:
        settings.read_dict(default_settings)
    except AttributeError:
        # using python 2.7
        for section, options in default_settings.items():
            settings.add_section(section)
            for option, value in options.items():
                settings.set(section, option, value)

    if config_file is not None and os.path.exists(config_file):
        settings.read(config_file)
        return settings
    if os.path.exists(CONFIG_FILE):
        settings.read(CONFIG_FILE)
        return settings
    return settings