def match(path, glob):
path_len = len(path)<EOL>glob_len = len(glob)<EOL>ss = -<NUM_LIT:1><EOL>ss_glob = glob<EOL>if '<STR_LIT>' in glob:<EOL><INDENT>ss = glob.index('<STR_LIT>')<EOL>if '<STR_LIT>' in glob[ss + <NUM_LIT:1>:]:<EOL><INDENT>raise dpath.exceptions.InvalidGlob("<STR_LIT>")<EOL><DEDENT>if path_len >= glob_len:<EOL><INDENT>more_stars = ['<STR_LIT:*>'] * (path_len - glob_len + <NUM_LIT:1>)<EOL>ss_glob = glob[:ss] + more_stars + glob[ss + <NUM_LIT:1>:]<EOL><DEDENT>elif path_len == glob_len - <NUM_LIT:1>:<EOL><INDENT>ss_glob = glob[:ss] + glob[ss + <NUM_LIT:1>:]<EOL><DEDENT><DEDENT>if path_len == len(ss_glob):<EOL><INDENT>if PY3:<EOL><INDENT>return all(map(fnmatch.fnmatch, list(map(str, paths_only(path))), list(map(str, ss_glob))))<EOL><DEDENT>else: <EOL><INDENT>return all(map(fnmatch.fnmatch, map(str, paths_only(path)), map(str, ss_glob)))<EOL><DEDENT><DEDENT>return False<EOL>
Match the path with the glob.

    Arguments:

    path -- A list of keys representing the path.
    glob -- A list of globs to match against the path.