code: def _check_index_within_index_pairs(index, index_ranges):
      
      in_range = False
      for index_range in index_ranges:
          if index_range[0] < index < index_range[1]:
              in_range = True
      return in_range
docs: Check that the index 'index' lies within the set of indexes.
      :param index: Index to determine whether it falls within the range or index pairs.
      :param index_ranges: A list of index pairs, monotonically increasing pairs.
      :return: True if the given index lies within a range specified by an index pair, False otherwise.