def _match(self, pred):
if not pred:<EOL><INDENT>return True<EOL><DEDENT>pred = pred[<NUM_LIT:1>:-<NUM_LIT:1>]<EOL>if pred.startswith('<STR_LIT:@>'):<EOL><INDENT>pred = pred[<NUM_LIT:1>:]<EOL>if '<STR_LIT:=>' in pred:<EOL><INDENT>attr, value = pred.split('<STR_LIT:=>', <NUM_LIT:1>)<EOL>if value[<NUM_LIT:0>] in ('<STR_LIT:">', "<STR_LIT:'>"):<EOL><INDENT>value = value[<NUM_LIT:1>:]<EOL><DEDENT>if value[-<NUM_LIT:1>] in ('<STR_LIT:">', "<STR_LIT:'>"):<EOL><INDENT>value = value[:-<NUM_LIT:1>]<EOL><DEDENT>return self.attrs.get(attr) == value<EOL><DEDENT>else:<EOL><INDENT>return pred in self.attrs<EOL><DEDENT><DEDENT>elif num_re.match(pred):<EOL><INDENT>index = int(pred)<EOL>if index < <NUM_LIT:0>:<EOL><INDENT>if self.parent:<EOL><INDENT>return self.index == (len(self.parent._children) + index)<EOL><DEDENT>else:<EOL><INDENT>return index == <NUM_LIT:0><EOL><DEDENT><DEDENT>else:<EOL><INDENT>return index == self.index<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if '<STR_LIT:=>' in pred:<EOL><INDENT>tag, value = pred.split('<STR_LIT:=>', <NUM_LIT:1>)<EOL>if value[<NUM_LIT:0>] in ('<STR_LIT:">', "<STR_LIT:'>"):<EOL><INDENT>value = value[<NUM_LIT:1>:]<EOL><DEDENT>if value[-<NUM_LIT:1>] in ('<STR_LIT:">', "<STR_LIT:'>"):<EOL><INDENT>value = value[:-<NUM_LIT:1>]<EOL><DEDENT>for c in self._children:<EOL><INDENT>if c.tagname == tag and c.data == value:<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for c in self._children:<EOL><INDENT>if c.tagname == pred:<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return False<EOL>
Helper function to determine if this node matches the given predicate.