void () { HashSet<PyImportedNameDefiner> usedImportsInsideImportGuards = Sets.newHashSet(getImportsInsideGuard()); usedImportsInsideImportGuards.retainAll(getUsedImports()); for (PyImportedNameDefiner definer : usedImportsInsideImportGuards) { PyImportElement importElement = PyUtil.as(definer, PyImportElement.class); if (importElement == null) { continue; } final PyTargetExpression asElement = importElement.getAsNameElement(); final PyElement toHighlight = asElement != null ? asElement : importElement.getImportReferenceExpression(); registerProblem(toHighlight, PyPsiBundle.message("INSP.try.except.import.error", importElement.getVisibleName()), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } }