class_docstr: A token stream is an iterable that yields :class:`Token`\s.  The
  parser however does not iterate over it but calls :meth:`next` to go
  one token ahead.  The current active token is stored as :attr:`current`.
class_docstr_tok: ["A","token","stream","is","an","iterable","that","yields",":","class",":","`","Token","`","\\s",".","The","parser","however","does","not","iterate","over","it","but","calls",":","meth",":","`","next","`","to","go","one","token","ahead",".","The","current","active","token","is","stored","as",":","attr",":","`","current","`","."]
docstr: Expect a given token type and return it.  This accepts the same
  argument as :meth:`jinja2.lexer.Token.test`.
docstr_tok: ["Expect","a","given","token","type","and","return","it",".","This","accepts","the","same","argument","as",":","meth",":","`","jinja2.lexer.Token.test","`","."]
code: def expect(self, expr):
      """Expect a given token type and return it.  This accepts the same
      argument as :meth:`jinja2.lexer.Token.test`.
      """
      if not self.current.test(expr):
          expr = describe_token_expr(expr)
          if self.current.type is TOKEN_EOF:
              raise TemplateSyntaxError(
                  "unexpected end of template, expected %r." % expr,
                  self.current.lineno,
                  self.name,
                  self.filename,
              )
          raise TemplateSyntaxError(
              "expected token %r, got %r"
              % (expr, describe_token(self.current)),
              self.current.lineno,
              self.name,
              self.filename,
          )
      try:
          return self.current
      finally:
          next(self)
  
imports: import re
  from ast import literal_eval
  from collections import deque
  from operator import itemgetter
  from ._compat import implements_iterator
  from ._compat import intern
  from ._compat import iteritems
  from ._compat import text_type
  from .exceptions import TemplateSyntaxError
  from .utils import LRUCache
label_desc: Use image node_id 12 for calling the TokenStream obj's underlying member method code with example usage: obj.expect(expr) and returns: self