def _normalize_locale(locale: str | None = None) -> str | None:
    """
    Normalize the given locale string by replacing any underscores with hyphens and resolving any default locales into their base names.

    Args:
        locale (str or None): The locale string to normalize. If None, returns None.

    Returns:
        str or None: The normalized locale string, or None if the input was None.

    Raises:
        TypeError: If the resolved locale is not of type 'str'.
    """

    # If `locale` is None then return None (we don't need to normalize anything here)
    if locale is None:
        return None

    # Replace any underscores with hyphens
    supplied_locale = _str_replace(locale, "_", "-")

    # Resolve any default locales into their base names (e.g., 'en-US' -> 'en')
    # TODO: remove pandas
    default_locales = _get_default_locales_data()

    matches = [
        entry["base_locale"]
        for entry in default_locales
        if entry["default_locale"] == supplied_locale
    ]

    if matches:
        return matches[0]

    try:
        babel.Locale.parse(supplied_locale, sep="-")
    except babel.UnknownLocaleError:
        raise ValueError(
            f"Supplied locale `{supplied_locale}` is not a known locale. "
            "Great Tables uses the libraries like babel for locale-based work. "
            "See the babel.Locale class for more on locale handling."
        )

    return supplied_locale

    Normalize the given locale string by replacing any underscores with hyphens and resolving any default locales into their base names.

    Args:
        locale (str or None): The locale string to normalize. If None, returns None.

    Returns:
        str or None: The normalized locale string, or None if the input was None.

    Raises:
        TypeError: If the resolved locale is not of type 'str'.
    
great_tables/_formats.py