public static @Nullable String getInterpreterVersion(final @Nullable Project project,
                                             final @NotNull PyRemoteSdkAdditionalDataBase data,
                                             final boolean nullForUnparsableVersion)
    throws RemoteSdkException {
    final Ref<String> result = Ref.create(null);
    final Ref<RemoteSdkException> exception = Ref.create(null);

    final Task.Modal task = new Task.Modal(project, PyBundle.message("python.sdk.getting.remote.interpreter.version"), true) {
      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        final PythonSdkFlavor flavor = data.getFlavor();
        if (flavor != null) {
          ProcessOutput processOutput;
          try {
            try {
              String[] command = {data.getInterpreterPath(), flavor.getVersionOption()};
              processOutput = PyRemoteProcessStarterManagerUtil.getManager(data).executeRemoteProcess(myProject, command, null,
                                                                                                      data, new PyRemotePathMapper());
              if (processOutput.getExitCode() == 0) {
                final String version = flavor.getVersionStringFromOutput(processOutput);
                if (version != null || nullForUnparsableVersion) {
                  result.set(version);
                  return;
                }
              }
              exception.set(createException(processOutput, command));
            }
            catch (Exception e) {
              throw RemoteSdkException.cantObtainRemoteCredentials(e);
            }
          }
          catch (RemoteSdkException e) {
            exception.set(e);
          }
        }
      }
    };

    if (!ProgressManager.getInstance().hasProgressIndicator()) {

      UIUtil.invokeAndWaitIfNeeded(() -> ProgressManager.getInstance().run(task));
    }
    else {
      task.run(ProgressManager.getInstance().getProgressIndicator());
    }

    if (!exception.isNull()) {
      throw exception.get();
    }

    return result.get();
  }
public static @Nullable String getInterpreterVersion(final @Nullable Project project,
                                             final @NotNull PyRemoteSdkAdditionalDataBase data,
                                             final boolean nullForUnparsableVersion)