def next(self, advance=True):
    escaped = False
    token = ''
    previous_index = self.index
    while self.remainder():
      char = self._format_string[self.index]
      if char == self.ESCAPE_CHAR:
        if escaped:
          token += char
          self.index += 1
          escaped = False
        else:
          self.index += 1
          escaped = True
      elif char in self.SPECIAL_CHARS and not escaped:
        if not token.strip():
          self.index += 1
          token += char
        break
      else:
        escaped = False
        self.index += 1
        token += char

    if not advance:
      self.index = previous_index

    return token.strip()
Returns the next token with surrounding white spaces stripped.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/mapreduce/file_format_parser.py/_Tokenizer.next