def _get_tag_match(self, ele, tree):
if tree in [None, []]:<EOL><INDENT>return [ele]<EOL><DEDENT>res = []<EOL>t = tree[<NUM_LIT:0>]<EOL>branch = tree[<NUM_LIT:1>:]<EOL>attributes = {}<EOL>for attr in t:<EOL><INDENT>if isinstance(t[attr], dict):<EOL><INDENT>if t[attr].get("<STR_LIT:type>", None) == "<STR_LIT>":<EOL><INDENT>t[attr] = re.compile(t[attr]['<STR_LIT>'])<EOL><DEDENT><DEDENT><DEDENT>attributes.update(t)<EOL>if "<STR_LIT:name>" in attributes:<EOL><INDENT>del attributes['<STR_LIT:name>']<EOL><DEDENT>if "<STR_LIT:text>" in attributes:<EOL><INDENT>del attributes['<STR_LIT:text>']<EOL><DEDENT>if "<STR_LIT>" in attributes:<EOL><INDENT>del attributes['<STR_LIT>']<EOL><DEDENT>if "<STR_LIT>" in attributes:<EOL><INDENT>del attributes['<STR_LIT>']<EOL><DEDENT>possibles = ele.find_all(<EOL>t.get('<STR_LIT:name>', None),<EOL>text=t.get('<STR_LIT:text>', None),<EOL>attrs=attributes,<EOL>recursive=t.get('<STR_LIT>', True)<EOL>)<EOL>if not possibles:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>pass<EOL><DEDENT>if "<STR_LIT>" in t:<EOL><INDENT>try:<EOL><INDENT>possibles = eval("<STR_LIT>".format(t["<STR_LIT>"]))<EOL><DEDENT>except:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>if not isinstance(possibles, list):<EOL><INDENT>possibles = [possibles]<EOL><DEDENT>for a in possibles:<EOL><INDENT>match = self._get_tag_match(a, branch)<EOL>if match:<EOL><INDENT>res.extend(match)<EOL><DEDENT><DEDENT>if not res:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>return res<EOL><DEDENT>
Match tag

:param ele:
:type ele:
:param tree:
:type tree: None, list
:return:
:rtype: None | list