+from nominatim.errors import UsageError
+
+def _flatten_name_list(names):
+ if names is None:
+ return {}
+
+ if not isinstance(names, dict):
+ raise UsageError("Expected key-value list for names in country_settings.py")
+
+ flat = {}
+ for prefix, remain in names.items():
+ if isinstance(remain, str):
+ flat[prefix] = remain
+ elif not isinstance(remain, dict):
+ raise UsageError("Entries in names must be key-value lists.")
+ else:
+ for suffix, name in remain.items():
+ if suffix == 'default':
+ flat[prefix] = name
+ else:
+ flat[f'{prefix}:{suffix}'] = name
+
+ return flat
+