def normalize_i18n(x):
    """
    Normalize accepted lang codes to ISO format.

    Also check if language codes are valid.
    """
    if x is None:
        return None
    return x.replace('-', '_')
