code: def get_uri_for_directory(
      directory: str, excludes: Optional[List[str]] = None
  ) -> str:
      """Get a content-addressable URI from a directory's contents.
  
      This function will generate the name of the package by the directory.
      It'll go through all the files in the directory and hash the contents
      of the files to get the hash value of the package.
      The final package name is: _ray_pkg_<HASH_VAL>.zip of this package.
      e.g., _ray_pkg_029f88d5ecc55e1e4d64fc6e388fd103.zip
  
      Examples:
  
          >>> get_uri_for_directory("/my_directory")  # doctest: +SKIP
          _ray_pkg_af2734982a741.zip
  
      Args:
          directory: The directory.
          excludes (list[str]): The dir or files that should be excluded.
  
      Returns:
          URI (str)
  
      Raises:
          ValueError if the directory doesn't exist.
      """
      if excludes is None:
          excludes = []
  
      directory = Path(directory).absolute()
      if not directory.exists() or not directory.is_dir():
          raise ValueError(
              f"directory {directory} must be an existing directory"
          )
  
      hash_val = _hash_directory(
          directory, directory, _get_excludes(directory, excludes)
      )
  
      return "{protocol}://{pkg_name}.zip".format(
          protocol=Protocol.GCS.value,
          pkg_name=RAY_PKG_PREFIX + hash_val.hex(),
      )
  
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 17 for calling a global function with example usage: get_uri_for_directory(directory, excludes) and returns: str