code: def __getitem__(self, i):
      if i < 0:
          i = self.size + i
      if i < 0 or i >= self.size:
          raise IndexError(
              "Invalid index %d for [0, %d)" % (i, self.size)
          )
      # Want j = maximal such that offsets[j] <= i
  
      j = len(self.intervals) - 1
      if self.offsets[j] > i:
          hi = j
          lo = 0
          # Invariant: offsets[lo] <= i < offsets[hi]
          while lo + 1 < hi:
              mid = (lo + hi) // 2
              if self.offsets[mid] <= i:
                  lo = mid
              else:
                  hi = mid
          j = lo
      t = i - self.offsets[j]
      u, v = self.intervals[j]
      r = u + t
      assert r <= v
      return r
  
file_path: catboost/contrib/python/hypothesis/py2/hypothesis/internal/intervalsets.py
imports: from __future__ import absolute_import, division, print_function
label_desc: Use image node_id 4 for calling the IntervalSet obj's underlying member method code with example usage: obj.__getitem__(i) and returns: r