code: def allele_indices_for_genotype_likelihood_index(gl_index, ploidy=2):
      """Returns a tuple of allele_indices corresponding to the given GL index.
  
      This is the inverse function to `genotype_likelihood_index`.
  
      Args:
        gl_index: int. The index within a genotype likelihood array for which to
          determine the associated alleles.
        ploidy: int. The ploidy of the result.
  
      Returns:
        A tuple of `ploidy` ints representing the allele indices at this GL index.
  
      Raises:
        NotImplementedError: The requested allele indices are more than diploid.
      """
      if ploidy == 1:
          return gl_index
      elif ploidy == 2:
          # TODO: Implement using algorithm described at
          # https://genome.sph.umich.edu/wiki/Relationship_between_Ploidy,_Alleles_and_Genotypes
          # rather than creating all genotypes explicitly.
          num_alts = 1
          while (
              genotype_likelihood_index([num_alts, num_alts]) < gl_index
          ):
              num_alts += 1
          genotypes = list(
              _genotype_order_in_likelihoods(num_alts, ploidy=ploidy)
          )
          return genotypes[gl_index]
      else:
          raise NotImplementedError(
              "Allele calculations only supported for haploid and diploid."
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import enum
  import itertools
  import six
  from third_party.nucleus.protos import variants_pb2
  from third_party.nucleus.util import ranges
  from third_party.nucleus.util import variantcall_utils
  from third_party.nucleus.util import vcf_constants
label_desc: Use image node_id 37 for calling a global function with example usage: allele_indices_for_genotype_likelihood_index(gl_index, ploidy) and returns: gl_index, genotypes