boolean (PyClass pyClass) { if (isBaseException(pyClass.getQualifiedName())) { return true; } for (PyClassLikeType type : pyClass.getAncestorTypes(TypeEvalContext.codeInsightFallback(pyClass.getProject()))) { if (type != null && isBaseException(type.getClassQName())) { return true; } } return false; }