Optional<PsiElement> (@NotNull List<UsageInfo> usages, @NotNull PsiFile destination) { return usages.stream() .map(UsageInfo::getElement) .filter(Objects::nonNull) .filter(element -> ScopeUtil.getScopeOwner(element) == destination) .filter(element -> PyImportStatementNavigator.getImportStatementByElement(element) == null) .min(PsiUtilCore::compareElementsByPosition); }