code: def pin_runtime_env_uri(
      uri: str, *, expiration_s: Optional[int] = None
  ) -> None:
      """Pin a reference to a runtime_env URI in the GCS on a timeout.
  
      This is used to avoid premature eviction in edge conditions for job
      reference counting. See https://github.com/ray-project/ray/pull/24719.
  
      Packages are uploaded to GCS in order to be downloaded by a runtime env plugin
      (e.g. working_dir, py_modules) after the job starts.
  
      This function adds a temporary reference to the package in the GCS to prevent
      it from being deleted before the job starts. (See #23423 for the bug where
      this happened.)
  
      If this reference didn't have an expiration, then if the script exited
      (e.g. via Ctrl-C) before the job started, the reference would never be
      removed, so the package would never be deleted.
      """
  
      if expiration_s is None:
          expiration_s = int(
              os.environ.get(
                  RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_ENV_VAR,
                  RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_DEFAULT,
              )
          )
      elif not isinstance(expiration_s, int):
          raise ValueError(
              f"expiration_s must be an int, got {type(expiration_s)}."
          )
  
      if expiration_s < 0:
          raise ValueError(
              f"expiration_s must be >= 0, got {expiration_s}."
          )
      elif expiration_s > 0:
          _pin_runtime_env_uri(uri, expiration_s=expiration_s)
  
imports: import asyncio
  import hashlib
  import logging
  import os
  import shutil
  from enum import Enum
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from typing import Callable, List, Optional, Tuple
  from urllib.parse import urlparse
  from zipfile import ZipFile
  from filelock import FileLock
  from ray.util.annotations import DeveloperAPI
  from ray._private.ray_constants import RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_DEFAULT, RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_ENV_VAR, RAY_RUNTIME_ENV_IGNORE_GITIGNORE
  from ray._private.runtime_env.conda_utils import exec_cmd_stream_to_logger
  from ray._private.thirdparty.pathspec import PathSpec
  from ray.experimental.internal_kv import _internal_kv_exists, _internal_kv_put, _pin_runtime_env_uri
label_desc: Use image node_id 11 for calling a global function with example usage: pin_runtime_env_uri(uri) without return types