code: def _expect_token(lexer, types):
      
      tok = next(lexer)
      if any(isinstance(tok, t) for t in types):
          return tok
      else:
          raise Error("unexpected token: " + str(tok))
docs: Return the next token, or raise an exception.