code: def match_token(token, tok_type, tok_str=None):
    
    return token.type == tok_type and (tok_str is None or token.string == tok_str)
docs: Returns true if token is of the given type and, if a string is given, has that string.