def METHOD_NAME(
        config_path: Optional[str]=None,
        _get_color_from_vdir: Callable=get_color_from_vdir,
        _get_vdir_type: Callable=get_vdir_type) -> ConfigObj:
    """reads the config file, validates it and return a config dict
    :param config_path: path to a custom config file, if none is given the
                        default locations will be searched
    :param _get_color_from_vdir: override get_color_from_vdir for testing purposes
    :param _get_vdir_type: override get_vdir_type for testing purposes
    :returns: configuration
    """
    if config_path is None:
        config_path = find_configuration_file()
    if config_path is None or not os.path.exists(config_path):
        raise NoConfigFile()
    logger.debug(f'using the config file at {config_path}')
    try:
        user_config = ConfigObj(config_path,
                                configspec=SPECPATH,
                                interpolation=False,
                                file_error=True,
                                )
    except ConfigObjError as error:
        logger.fatal('parsing the config file with the following error: '
                     f'{error}')
        logger.fatal('if you recently updated khal, the config file format '
                     'might have changed, in that case please consult the '
                     'CHANGELOG or other documentation')
        raise CannotParseConfigFileError()
    fdict = {'timezone': is_timezone,
             'timedelta': is_timedelta,
             'expand_path': expand_path,
             'expand_db_path': expand_db_path,
             'weeknumbers': weeknumber_option,
             'monthdisplay': monthdisplay_option,
             'color': is_color,
             }
    validator = Validator(fdict)
    results = user_config.validate(validator, preserve_errors=True)
    abort = False
    for section, subsection, config_error in flatten_errors(user_config, results):
        abort = True
        if isinstance(config_error, Exception):
            logger.fatal(
                f'config error:\n'
                f'in [{section[0]}] {subsection}: {config_error}')
        else:
            for key in config_error:
                if isinstance(config_error[key], Exception):
                    logger.fatal(
                        'config error:\n'
                        f'in {sectionize(section + [subsection])} {key}: '
                        f'{str(config_error[key])}'
                    )
    if abort or not results:
        raise InvalidSettingsError()
    config_checks(user_config, _get_color_from_vdir, _get_vdir_type)
    extras = get_extra_values(user_config)
    for section, value in extras:
        if section == ():
            logger.warning(f'unknown section "{value}" in config file')
        else:
            section = sectionize(section)
            logger.warning(
                f'unknown key or subsection "{value}" in section "{section}"')
            deprecated = [{'value': 'default_command', 'section': 'default'}]
            for d in deprecated:
                if (value == d['value']) and (section == d['section']):
                    logger.warning(f'Key "{value}" in section "{section}" was '
                                   'deprecated. See the FAQ to find out when and why!')
    return user_config