def METHOD_NAME(configpath: str) -> dict:
    if os.path.splitext(configpath)[-1] == '.toml':
        with open(configpath, 'rb') as f:
            config = tomllib.load(f)
    else:
        rawconfig = BugwarriorConfigParser()
        rawconfig.readfp(codecs.open(configpath, "r", "utf-8",))
        config = {}
        for section in rawconfig.sections():
            if section in ['hooks', 'notifications']:
                config[section] = rawconfig[section].items()
            elif section == 'general':
                config[section] = {k.replace('log.', 'log_'): v
                                   for k, v in rawconfig[section].items()}
            elif section.startswith('flavor.'):
                config['flavor'][section.split('.')[-1]] = {
                    k.replace('.', '_'): v
                    for k, v in rawconfig[section].items()}
            else:
                service = rawconfig[section].pop('service')
                service_prefix = 'ado' if service == 'azuredevops' else service
                config[section] = {'service': service}
                for k, v in rawconfig[section].items():
                    try:
                        prefix, key = k.split('.')
                    except ValueError:  # missing prefix
                        prefix = None
                        key = k
                    if prefix != service_prefix:
                        raise SystemExit(
                            f"[{section}]\n{k} <-expected prefix "
                            f"'{service_prefix}': did you mean "
                            f"'{service_prefix}.{key}'?")
                    config[section][key] = v
    return config