boolean (@NotNull PyStatement statement) { final PyExpression raisedExpression = Optional .ofNullable(as(statement, PyRaiseStatement.class)) .map(PyRaiseStatement::getExpressions) .filter(expressions -> expressions.length == 1) .map(expressions -> expressions[0]) .orElse(null); if (raisedExpression instanceof PyCallExpression) { final PyExpression callee = ((PyCallExpression)raisedExpression).getCallee(); if (callee != null && callee.getText().equals(PyNames.NOT_IMPLEMENTED_ERROR)) { return true; } } else if (raisedExpression != null && raisedExpression.getText().equals(PyNames.NOT_IMPLEMENTED_ERROR)) { return true; } return false; }