code: def locate_key(self, k1, k2=None):
          
  
          loc1 = self.l1.locate_key(k1)
          if k2 is None:
              return loc1
          if isinstance(loc1, slice):
              offset = loc1.start
              try:
                  loc2 = SortedIndex(self.l2[loc1], copy=False).locate_key(k2)
              except KeyError:
                  # reraise with more information
                  raise KeyError(k1, k2)
              else:
                  if isinstance(loc2, slice):
                      loc = slice(offset + loc2.start, offset + loc2.stop)
                  else:
                      # assume singleton
                      loc = offset + loc2
          else:
              # singleton match in l1
              v = self.l2[loc1]
              if v == k2:
                  loc = loc1
              else:
                  raise KeyError(k1, k2)
          return loc
docs: Get index location for the requested key.
  
          Parameters
          ----------
          k1 : object
              Level 1 key.
          k2 : object, optional
              Level 2 key.
  
          Returns
          -------
          loc : int or slice
              Location of requested key (will be slice if there are duplicate
              entries).
  
          Examples
          --------
  
          >>> import allel
          >>> chrom = ['chr1', 'chr1', 'chr2', 'chr2', 'chr2', 'chr3']
          >>> pos = [1, 4, 2, 5, 5, 3]
          >>> idx = allel.SortedMultiIndex(chrom, pos)
          >>> idx.locate_key('chr1')
          slice(0, 2, None)
          >>> idx.locate_key('chr1', 4)
          1
          >>> idx.locate_key('chr2', 5)
          slice(3, 5, None)
          >>> try:
          ...     idx.locate_key('chr3', 4)
          ... except KeyError as e:
          ...     print(e)
          ...
          ('chr3', 4)