private static boolean checkNeeded(Project project) {
    if (!hasPython(project)) return false;
    PyPackageService service = PyPackageService.getInstance();
    if (service.PYPI_REMOVED) return false;
    try {
      FileTime fileMTime = Files.getLastModifiedTime(PyPIPackageCache.getDefaultCachePath());
      if (fileMTime.toInstant().plus(EXPIRATION_TIMEOUT).isAfter(Instant.now())) {
        return false;
      }
    }
    catch (NoSuchFileException ignored) {
      // Non-existent cache file should be rebuilt
    }
    catch (IOException e) {
      LOG.warn(e);
    }
    LOG.debug("Updating outdated PyPI package cache");
    return true;
  }
private static boolean checkNeeded(Project project)