private static @NotNull Optional<PsiElement> findFirstTopLevelUsageInFile(@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);
  }
private static @NotNull Optional<PsiElement> findFirstTopLevelUsageInFile(@NotNull List<UsageInfo> usages, @NotNull PsiFile destination)