private static @Nullable LocalQuickFix getSuitableSdkFix(@Nullable String name, @NotNull Module module) {
      // this method is based on com.jetbrains.python.sdk.PySdkExtKt.suggestAssociatedSdkName
      // please keep it in sync with the mentioned method and com.jetbrains.python.PythonSdkConfigurator.configureSdk

      final List<Sdk> existingSdks = getExistingSdks();

      final var associatedSdk = PySdkExtKt.mostPreferred(PySdkExtKt.filterAssociatedSdks(module, existingSdks));
      if (associatedSdk != null) return new UseExistingInterpreterFix(associatedSdk, module);

      final UserDataHolderBase context = new UserDataHolderBase();

      List<PyDetectedSdk> detectedAssociatedEnvs = Collections.emptyList();
      while (true) {
        try {
          // Beware that this thread holds the read lock. Shouldn't wait too much.
          detectedAssociatedEnvs = DETECTED_ASSOCIATED_ENVS_CACHE.get(module).get(10, TimeUnit.MILLISECONDS);
          break;
        }
        catch (InterruptedException | TimeoutException ignored) {
          ProgressManager.checkCanceled();
        }
        catch (Exception e) {
          LOGGER.warn("Failed to get suitable sdk fix for name " + name + " and module " + module, e);
          break;
        }
      }
      final var detectedAssociatedSdk = ContainerUtil.getFirstItem(detectedAssociatedEnvs);
      if (detectedAssociatedSdk != null) return new UseDetectedInterpreterFix(detectedAssociatedSdk, existingSdks, true, module);

      final Pair<@IntentionName String, PyProjectSdkConfigurationExtension> textAndExtension
        = PyProjectSdkConfigurationExtension.findForModule(module);
      if (textAndExtension != null) return new UseProvidedInterpreterFix(module, textAndExtension.getSecond(), textAndExtension.getFirst());

      if (name != null) {
        final Matcher matcher = NAME.matcher(name);
        if (matcher.matches()) {
          final String venvName = matcher.group("name");
          if (venvName != null) {
            final PyDetectedSdk detectedAssociatedViaRootNameEnv = detectAssociatedViaRootNameEnv(venvName, module, existingSdks, context);
            if (detectedAssociatedViaRootNameEnv != null) {
              return new UseDetectedInterpreterFix(detectedAssociatedViaRootNameEnv, existingSdks, true, module);
            }
          }
          else {
            final PyDetectedSdk detectedSystemWideSdk = detectSystemWideSdk(matcher.group("version"), module, existingSdks, context);
            if (detectedSystemWideSdk != null) return new UseDetectedInterpreterFix(detectedSystemWideSdk, existingSdks, false, module);
          }
        }
      }

      if (PyCondaSdkCustomizer.Companion.getInstance().getSuggestSharedCondaEnvironments()) {
        final var sharedCondaEnv = PySdkExtKt.mostPreferred(PySdkExtKt.filterSharedCondaEnvs(module, existingSdks));
        if (sharedCondaEnv != null) return new UseExistingInterpreterFix(sharedCondaEnv, module);
      }

      final var systemWideSdk = PySdkExtKt.mostPreferred(PySdkExtKt.filterSystemWideSdks(existingSdks));
      if (systemWideSdk != null) return new UseExistingInterpreterFix(systemWideSdk, module);

      final var detectedSystemWideSdk = ContainerUtil.getFirstItem(PySdkExtKt.detectSystemWideSdks(module, existingSdks));
      if (detectedSystemWideSdk != null) return new UseDetectedInterpreterFix(detectedSystemWideSdk, existingSdks, false, module);

      return null;
    }
private static @Nullable LocalQuickFix getSuitableSdkFix(@Nullable String name, @NotNull Module module)