def find_tokens(sentence, pattern):
if not verify_pattern(pattern):<EOL><INDENT>raise PatternSyntaxException(pattern)<EOL><DEDENT>def _match_node(t, p, tokens):<EOL><INDENT>pat_node = p.pop(<NUM_LIT:0>) if p else "<STR_LIT>"<EOL>res = not pat_node or (_match_token(t, pat_node, False) and (not p or _match_edge(t.children, p, tokens)))<EOL>if res and not p:<EOL><INDENT>tokens.append(t)<EOL><DEDENT>return res<EOL><DEDENT>def _match_edge(edges,p, tokens):<EOL><INDENT>pat_edge = p.pop(<NUM_LIT:0>) if p else "<STR_LIT>"<EOL>if pat_edge:<EOL><INDENT>for (t) in edges:<EOL><INDENT>if _match_token(t, pat_edge, True):<EOL><INDENT>_match_node(t, list(p), tokens)<EOL>if pat_edge == "<STR_LIT>":<EOL><INDENT>_match_edge(t.children, ["<STR_LIT>"] + p, tokens)<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>result_tokens = []<EOL>_match_node(sentence.root, pattern.split("<STR_LIT:/>"), result_tokens)<EOL>return result_tokens<EOL>
Find all tokens from parts of sentence fitted to pattern, being on the end of matched sub-tree(of sentence)

        :param sentence: sentence from Spacy(see: http://spacy.io/docs/#doc-spans-sents) representing complete statement
        :param pattern: pattern to which sentence will be compared

        :return: Spacy tokens(see: http://spacy.io/docs/#token) found at the end of pattern if whole pattern match

        :raises: PatternSyntaxException: if pattern has wrong syntax