private void setSdkAssociated(SdkModificator modificator, boolean isAssociated) {
   PythonSdkAdditionalData additionalData =
       (PythonSdkAdditionalData) modificator.getSdkAdditionalData();
   if (additionalData == null) {
     additionalData =
         new PythonSdkAdditionalData(PythonSdkFlavor.getFlavor(modificator.getHomePath()));
     modificator.setSdkAdditionalData(additionalData);
   }
   if (isAssociated) {
     additionalData.associateWithProject(myProject);
   } else {
     additionalData.setAssociatedProjectPath(null);
   }
 }
  @Override
  public void consume(@Nullable AbstractProjectSettingsStep settingsStep) {
    if (myRunnable != null) {
      myRunnable.run();
    }
    if (settingsStep == null) return;

    Sdk sdk = settingsStep.getSdk();
    final Project project = ProjectManager.getInstance().getDefaultProject();
    final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel();
    if (sdk instanceof PyDetectedSdk) {
      final String name = sdk.getName();
      VirtualFile sdkHome =
          ApplicationManager.getApplication()
              .runWriteAction(
                  new Computable<VirtualFile>() {
                    @Override
                    public VirtualFile compute() {
                      return LocalFileSystem.getInstance().refreshAndFindFileByPath(name);
                    }
                  });
      PySdkService.getInstance().solidifySdk(sdk);
      sdk =
          SdkConfigurationUtil.setupSdk(
              ProjectJdkTable.getInstance().getAllJdks(),
              sdkHome,
              PythonSdkType.getInstance(),
              true,
              null,
              null);
      model.addSdk(sdk);
      settingsStep.setSdk(sdk);
      try {
        model.apply();
      } catch (ConfigurationException exception) {
        LOG.error("Error adding detected python interpreter " + exception.getMessage());
      }
    }
    Project newProject = generateProject(project, settingsStep);
    if (newProject != null) {
      SdkConfigurationUtil.setDirectoryProjectSdk(newProject, sdk);
      final List<Sdk> sdks = PythonSdkType.getAllSdks();
      for (Sdk s : sdks) {
        final SdkAdditionalData additionalData = s.getSdkAdditionalData();
        if (additionalData instanceof PythonSdkAdditionalData) {
          ((PythonSdkAdditionalData) additionalData).reassociateWithCreatedProject(newProject);
        }
      }
    }
  }