code: def index(self, i, length=None):
          
          if self.begin <= i <= self.end:
              index = i - self.BEGIN - self.offset
              if length is None:
                  length = self.full_range()
              else:
                  length = min(length, self.full_range())
  
              if 0 <= index < length:
                  return index
docs: Return an integer index or None