boolean (@NotNull PsiReference reference) { if (reference instanceof PsiPolyVariantReference) { final ResolveResult[] results = ((PsiPolyVariantReference)reference).multiResolve(false); for (ResolveResult result : results) { final PsiElement resolved = result.getElement(); if (resolved instanceof PyImportElement && ((PyImportElement)resolved).getAsName() != null) { return false; } } } return true; }