boolean (@NotNull Instruction instruction) { final PsiElement element = instruction.getElement(); if (element == null) return false; if (element instanceof PyTryPart || element instanceof PyExceptPart || element instanceof PyConditionalExpression) return true; if (element instanceof PyForStatement) { final PyForPart forPart = ((PyForStatement)element).getForPart(); return !PyEvaluator.evaluateAsBoolean(forPart.getSource(), false); } if (instruction instanceof ConditionalInstruction conditionalInstruction) { final PsiElement condition = conditionalInstruction.getCondition(); if (condition instanceof PyExpression) { return conditionalInstruction.getResult() ? !PyEvaluator.evaluateAsBoolean((PyExpression)condition, false) : PyEvaluator.evaluateAsBoolean((PyExpression)condition, true); } } return false; }