private static <T> @NotNull Pair<@NotNull List<VirtualFile>, @NotNull List<VirtualFile>> splitIntoLibraryAndSourceRoots(@NotNull Sdk sdk,
                                                                                                                          @NotNull List<T> paths,
                                                                                                                          @NotNull Set<VirtualFile> moduleRoots,
                                                                                                                          @NotNull Collection<VirtualFile> excludedPaths,
                                                                                                                          @NotNull Function<T, @Nullable VirtualFile> mapper) {
    final List<VirtualFile> lib = new ArrayList<>();
    final List<VirtualFile> source = new ArrayList<>();
    for (T path : paths) {
      final VirtualFile rootFile = mapper.apply(path);
      if (rootFile != null && !excludedPaths.contains(rootFile)) {
        if (isUnderModuleRootsButNotSdk(rootFile, moduleRoots, sdk)) {
          source.add(rootFile);
        }
        else {
          lib.add(rootFile);
        }
        continue;
      }
      LOG.info("Bogus sys.path entry " + path);
    }
    return Pair.createNonNull(lib, source);
  }
private static <T> @NotNull Pair<@NotNull List<VirtualFile>, @NotNull List<VirtualFile>> splitIntoLibraryAndSourceRoots(@NotNull Sdk sdk,
                                                                                                                          @NotNull List<T> paths,
                                                                                                                          @NotNull Set<VirtualFile> moduleRoots,
                                                                                                                          @NotNull Collection<VirtualFile> excludedPaths,
                                                                                                                          @NotNull Function<T, @Nullable VirtualFile> mapper)