def _match(self, term, token):
    if isinstance(token, Tree):
        return (Terminal(token.data) == term)
    elif isinstance(token, Token):
        return (term == Terminal(token.type))
    assert False
def _match(self, term, token):
    if isinstance(token, Tree):
        return (Terminal(token.data) == term)
    elif isinstance(token, Token):
        return (term == Terminal(token.type))
    assert False