def getparent(self, cls):
current = self<EOL>while current and not isinstance(current, cls):<EOL><INDENT>current = current.parent<EOL><DEDENT>return current<EOL>
get the next parent node (including ourself)
        which is an instance of the given class