boolean (ASTNode node, PyElementType eltType) { if (node != null) { PsiElement checker = node.getPsi(); checker = checker.getPrevSibling(); // step from the source node while (checker != null) { ASTNode ch_node = checker.getNode(); if (ch_node == null) return false; else { if (ch_node.getElementType() == eltType) { return true; } else if (!(checker instanceof PsiWhiteSpace)) { return false; } } checker = checker.getPrevSibling(); } } return false; }