import re


def html_remove_translation_links(doc):
    """
    Remove translation links (the international flags).
    We identify them by the pattern for a 2 or 3 letter language code, /[a-z]{2,3}[/"]
    in the URL.
    The second version deals with links like /pt_PT and /zh_CN
    We are case sensitive, so as not to treat FAQ as a language code.
    """
    doc = re.sub(r'<a href="[^"]+/[a-z]{2,3}[/"][\s\S]+?</a>', r'', doc)
    doc = re.sub(r'<a href="[^"]+/[a-z]{2}_[A-Z]{2}[/"][\s\S]+?</a>', r'', doc)
    return doc