docs: def standardize_tag(tag: {str, Language}, macro: bool=False) -> str:
      """
      Standardize a language tag:
  
      - Replace deprecated values with their updated versions (if those exist)
      - Remove script tags that are redundant with the language
      - If *macro* is True, use a macrolanguage to represent the most common
        standardized language within that macrolanguage. For example, 'cmn'
        (Mandarin) becomes 'zh' (Chinese), and 'arb' (Modern Standard Arabic)
        becomes 'ar' (Arabic).
      - Format the result according to the conventions of BCP 47
  
      Macrolanguage replacement is not required by BCP 47, but it is required
      by the Unicode CLDR.
  
      >>> standardize_tag('en_US')
      'en-US'
  
      >>> standardize_tag('en-Latn')
      'en'
  
      >>> standardize_tag('en-uk')
      'en-GB'
  
      >>> standardize_tag('eng')
      'en'
  
      >>> standardize_tag('arb-Arab', macro=True)
      'ar'
  
      >>> standardize_tag('sh-QU')
      'sr-Latn-EU'
  
      >>> standardize_tag('sgn-US')
      'ase'
  
      >>> standardize_tag('zh-cmn-hans-cn')
      'cmn-Hans-CN'
  
      >>> standardize_tag('zh-cmn-hans-cn', macro=True)
      'zh-Hans-CN'
  
      >>> standardize_tag('zsm', macro=True)
      'ms'
  
      >>> standardize_tag('ja-latn-hepburn')
      'ja-Latn-hepburn'
  
      >>> standardize_tag('spa-latn-mx')
      'es-MX'
  
      If the tag can't be parsed according to BCP 47, this will raise a
      LanguageTagError (a subclass of ValueError):
  
      >>> standardize_tag('spa-mx-latn')
      Traceback (most recent call last):
          ...
      langcodes.tag_parser.LanguageTagError: This script subtag, 'latn', is out of place. Expected variant, extension, or end of string.
      """
      langdata = Language.get(tag, normalize=True)
      if macro:
          langdata = langdata.prefer_macrolanguage()
  
      return langdata.simplify_script().to_tag()