PsiElement () { final QualifiedName importSourceQName = getImportSourceQName(); if (importSourceQName != null) { final String name = importSourceQName.getLastComponent(); final PsiFile file = getContainingFile(); if (name != null && PyUtil.isPackage(file)) { final PsiElement resolvedImportSource = PyUtil.turnInitIntoDir(resolveImportSource()); if (resolvedImportSource != null && resolvedImportSource.getParent() == file.getContainingDirectory()) { return resolvedImportSource; } } } return null; }