code: def index(self, sub, *args):
          
          pos = self.find(sub, *args)
          if pos == -1:
              raise ValueError('substring not found')
          return pos
docs: Like newstr.find() but raise ValueError when the substring is not
          found.