code: def safe_classpath(classpath, synthetic_jar_dir, custom_name=None):
    
    if synthetic_jar_dir:
      safe_mkdir(synthetic_jar_dir)
    else:
      synthetic_jar_dir = safe_mkdtemp()
  
    # Quote the paths so that if they contain reserved characters can be safely passed to JVM classloader.
    bundled_classpath = [parse.quote(cp) for cp in relativize_classpath(classpath, synthetic_jar_dir)]
  
    manifest = Manifest()
    manifest.addentry(Manifest.CLASS_PATH, ' '.join(bundled_classpath))
  
    with temporary_file(root_dir=synthetic_jar_dir, cleanup=False, suffix='.jar') as jar_file:
      with open_zip(jar_file, mode='w', compression=ZIP_STORED) as jar:
        jar.writestr(Manifest.PATH, manifest.contents())
  
      if custom_name:
        custom_path = os.path.join(synthetic_jar_dir, custom_name)
        safe_concurrent_rename(jar_file.name, custom_path)
        return [custom_path]
      else:
        return [jar_file.name]
docs: Bundles classpath into one synthetic jar that includes original classpath in its manifest.
  
    This is to ensure classpath length never exceeds platform ARG_MAX.
  
    :param list classpath: Classpath to be bundled.
    :param string synthetic_jar_dir: directory to store the synthetic jar, if `None`
      a temp directory will be provided and cleaned up upon process exit. Otherwise synthetic
      jar will remain in the supplied directory, only for debugging purpose.
    :param custom_name: filename of the synthetic jar to be created.
  
    :returns: A classpath (singleton list with just the synthetic jar).
    :rtype: list of strings