def METHOD_NAME(self, node):
    if issubclass(node.__class__, remi.server.App):
        return node
    if not hasattr(node, "get_parent"):
        return None
    return self.METHOD_NAME(node.get_parent()) 