def choose_locale(self, locale: Text) -> Text:
        """
        Returns the best matching locale in what is available.

        :param locale: Locale to match
        :return: Locale to use
        """

        if locale not in self._choice_cache:
            locales = self.list_locales()

            best_choice = locales[0]
            best_level = 0

            for candidate in locales:
                cmp = compare_locales(locale, candidate)

                if cmp > best_level:
                    best_choice = candidate
                    best_level = cmp

            self._choice_cache[locale] = best_choice

        return self._choice_cache[locale]
Returns the best matching locale in what is available.

        :param locale: Locale to match
        :return: Locale to use