def METHOD_NAME(self, ttype, i):
    for child in self.getChildren():
        if not isinstance(child, TerminalNode):
            continue
        if child.symbol.type != ttype:
            continue
        if i==0:
            return child
        i -= 1
    return None