code: def match_token(token, tok_type, tok_str=None):
      # type: (Token, int, Optional[str]) -> bool
      """Returns true if token is of the given type and, if a string is given, has that string."""
      return token.type == tok_type and (
          tok_str is None or token.string == tok_str
      )
  
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 2 for calling a global function with example usage: match_token(token, tok_type, tok_str) and returns: unknown