code: def expect_token(token, tok_type, tok_str=None):
      # type: (Token, int, Optional[str]) -> None
      """
      Verifies that the given token is of the expected type. If tok_str is given, the token string
      is verified too. If the token doesn't match, raises an informative ValueError.
      """
      if not match_token(token, tok_type, tok_str):
          raise ValueError(
              "Expected token %s, got %s on line %s col %s"
              % (
                  token_repr(tok_type, tok_str),
                  str(token),
                  token.start[0],
                  token.start[1] + 1,
              )
          )
  
imports: import ast
  import collections
  import io
  import sys
  import token
  import tokenize
  from abc import ABCMeta
  from ast import Module, expr, AST
  from typing import Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union, cast, Any, TYPE_CHECKING
  from six import iteritems
label_desc: Use image node_id 3 for calling a global function with example usage: expect_token(token, tok_type, tok_str) without return types