def find_matching_language(lang: str) -> Optional[str]:
    """
    Given a two-letter ISO 639-1 or three-letter ISO 639-3 language code,
    find a supported spaCy language.

    Returns the language code if a matching language is available, or None
    if there is no matching language.

    >>> find_matching_language('fra')  # ISO 639-3 code for French
    'fr'
    >>> find_matching_language('fre')  # ISO 639-2/B code for French
    'fr'
    >>> find_matching_language('iw')  # Obsolete ISO 639-1 code for Hebrew
    'he'
    >>> find_matching_language('mo')  # Deprecated code for Moldavian
    'ro'
    >>> find_matching_language('scc')  # Deprecated ISO 639-2/B code for Serbian
    'sr'
    >>> find_matching_language('zxx')
    None
    """
    import spacy.lang  # noqa: F401

    # Check aliases
    for lang_code, aliases in LANG_ALIASES.items():
        if lang in aliases:
            return lang_code

    return None

    Given a two-letter ISO 639-1 or three-letter ISO 639-3 language code,
    find a supported spaCy language.

    Returns the language code if a matching language is available, or None
    if there is no matching language.

    >>> find_matching_language('fra')  # ISO 639-3 code for French
    'fr'
    >>> find_matching_language('fre')  # ISO 639-2/B code for French
    'fr'
    >>> find_matching_language('iw')  # Obsolete ISO 639-1 code for Hebrew
    'he'
    >>> find_matching_language('mo')  # Deprecated code for Moldavian
    'ro'
    >>> find_matching_language('scc')  # Deprecated ISO 639-2/B code for Serbian
    'sr'
    >>> find_matching_language('zxx')
    None
    
spacy/util.py