code: def locate_range(self, key, start=None, stop=None):
          
  
          loc1 = self.l1.locate_key(key)
          if start is None and stop is None:
              loc = loc1
          elif isinstance(loc1, slice):
              offset = loc1.start
              idx = SortedIndex(self.l2[loc1], copy=False)
              try:
                  loc2 = idx.locate_range(start, stop)
              except KeyError:
                  raise KeyError(key, start, stop)
              else:
                  loc = slice(offset + loc2.start, offset + loc2.stop)
          else:
              # singleton match in l1
              v = self.l2[loc1]
              if start <= v <= stop:
                  loc = loc1
              else:
                  raise KeyError(key, start, stop)
          # ensure slice is always returned
          if not isinstance(loc, slice):
              loc = slice(loc, loc + 1)
          return loc
docs: Locate slice of index containing all entries within the range
          `key`:`start`-`stop` **inclusive**.
  
          Parameters
          ----------
          key : object
              Level 1 key value.
          start : object, optional
              Level 2 start value.
          stop : object, optional
              Level 2 stop value.
  
          Returns
          -------
          loc : slice
              Slice object.
  
          Examples
          --------
  
          >>> import allel
          >>> chrom = ['chr1', 'chr1', 'chr2', 'chr2', 'chr2', 'chr3']
          >>> pos = [1, 4, 2, 5, 5, 3]
          >>> idx = allel.SortedMultiIndex(chrom, pos)
          >>> idx.locate_range('chr1')
          slice(0, 2, None)
          >>> idx.locate_range('chr1', 1, 4)
          slice(0, 2, None)
          >>> idx.locate_range('chr2', 3, 7)
          slice(3, 5, None)
          >>> try:
          ...     idx.locate_range('chr3', 4, 9)
          ... except KeyError as e:
          ...     print(e)
          ('chr3', 4, 9)