public static File copyResourceToTempFile(String basename, String extension) throws IOException {
    final File tempFile = FileUtil.createTempFile(basename, extension);
    final byte[] buffer = new byte[4096];

    try (InputStream in = HgUtil.class.getClassLoader().getResourceAsStream("python/" + basename + extension);
         OutputStream out = new FileOutputStream(tempFile, false)) {
      int bytesRead;
      while ((bytesRead = in.read(buffer)) != -1) {
        out.write(buffer, 0, bytesRead);
      }
    }
    tempFile.deleteOnExit();
    return tempFile;
  }
public static File copyResourceToTempFile(String basename, String extension)