docs: def normalize_allele_name(raw_allele, omit_dra1=False, infer_class2_pair=True):
      """MHC alleles are named with a frustratingly loose system. It's not uncommon
      to see dozens of different forms for the same allele.
  
      Note: this function works with both class I and class II allele names (including
      alpha/beta pairs).
  
      For example, these all refer to the same MHC sequence:
          - HLA-A*02:01
          - HLA-A02:01
          - HLA-A:02:01
          - HLA-A0201
          - HLA-A00201
  
      Additionally, for human alleles, the species prefix is often omitted:
          - A*02:01
          - A*00201
          - A*0201
          - A02:01
          - A:02:01
          - A:002:01
          - A0201
          - A00201
  
      We might also encounter "6 digit" and "8 digit" MHC types (which specify
      variants that don't affect amino acid sequence), for our purposes these
      should be truncated to their "4-digit" forms:
          - A*02:01:01
          - A*02:01:01:01
      There are also suffixes which we're going to ignore:
          - HLA-A*02:01:01G
  
      And lastly, for human alleles, there are serotypes which we'll treat
      as approximately equal to a 4-digit type.
          - HLA-A2
          - A2
  
      These should all be normalized to:
          HLA-A*02:01
      """
      cache_key = (raw_allele, omit_dra1, infer_class2_pair)
      if cache_key in _normalized_allele_cache:
          return _normalized_allele_cache[cache_key]
  
      parsed_alleles = parse_classi_or_classii_allele_name(
          raw_allele, infer_pair=infer_class2_pair)
      species = parsed_alleles[0].species
      normalized_list = [species]
      # Optionally omit the alpha allele, e.g. for IEDB predictors.
      if omit_dra1 and len(parsed_alleles) == 2:
          alpha, beta = parsed_alleles
          # by convention the alpha allelle is omitted since it's assumed
          # to be DRA1*01:01
          if alpha == _DRA1_0101:
              parsed_alleles = [beta]
      for parsed_allele in parsed_alleles:
          if len(parsed_allele.allele_family) > 0:
              normalized_list.append("%s*%s:%s" % (
                  parsed_allele.gene,
                  parsed_allele.allele_family,
                  parsed_allele.allele_code))
          else:
              # mice don't have allele families
              # e.g. H-2-Kd
              # species = H-2
              # gene = K
              # allele = d
              normalized_list.append("%s%s" % (
                  parsed_allele.gene,
                  parsed_allele.allele_code))
      normalized = "-".join(normalized_list)
  
      _normalized_allele_cache[cache_key] = normalized
      return normalized