PyIfStatement (@Nullable PyIfStatement ifStatement) { while (ifStatement != null && !(getFirstStatement(ifStatement) instanceof PyIfStatement)) { ifStatement = PsiTreeUtil.getParentOfType(ifStatement, PyIfStatement.class); } return ifStatement; }