Since `match_locale_regex` is only used once, you can just pass the regex as a string here. Python caches the most recent regex patterns so there's no performance savings for regexes built within the function.

Alternatively, you can move the regex outside of the function.