docs: def _get_token(self, regex=None):
          """ Consumes the next token in the token stream.
  
              `regex`
                  Validate against the specified `re.compile()` regex instance.
  
              Returns token string.
  
              * Raises a ``ParseError`` exception if stream is empty or regex
                match fails.
              """
  
          item = self._lexer.get_token()
  
          if not item:
              raise ParseError(u'Unexpected end of file')
          else:
              line_no, token = item
              if regex and not regex.match(token):
                  pattern = u"Unexpected format in token '{0}' on line {1}"
                  token_val = common.from_utf8(token.strip())
                  raise ParseError(pattern.format(token_val, line_no))
  
              return token