public static @Nullable Sdk findSdkForDirectory(@NotNull Project project, @NotNull Path workingDirectory, boolean allowRemote) {
    VirtualFile workingDirectoryVirtualFile = LocalFileSystem.getInstance().findFileByNioFile(workingDirectory);
    if (workingDirectoryVirtualFile != null) {
      Sdk sdk = getLocalSdkForFile(project, workingDirectoryVirtualFile, allowRemote);
      if (sdk != null) {
        return sdk;
      }
    }

    for (Module m : ModuleManager.getInstance(project).getModules()) {
      Sdk sdk = PythonSdkUtil.findPythonSdk(m);
      if (sdk != null && (allowRemote || !PythonSdkUtil.isRemote(sdk))) {
        return sdk;
      }
    }

    return null;
  }
public static @Nullable Sdk findSdkForDirectory(@NotNull Project project, @NotNull Path workingDirectory, boolean allowRemote)