code: def up_to(self, term: str) -> str:
          
          end = self.input.find(term, self.offset)
          if end < 0:
              raise EndOfInput(self)
          res = self.input[self.offset:end]
          self.offset = end + 1
          return res
docs: Parse and return segment terminated by the first occurence of a string.
  
          Args:
              term: Terminating string.
  
          Raises:
              EndOfInput: If `term` does not occur in the rest of the input text.