code: def client_cache(
      name, region, max_retries=BOTO_MAX_RETRIES, **kwargs
  ) -> BaseClient:
      try:
          # try to re-use a client from the resource cache first
          return resource_cache(
              name, region, max_retries, **kwargs
          ).meta.client
      except ResourceNotExistsError:
          # fall back for clients without an associated resource
          cli_logger.verbose(
              "Creating AWS client `{}` in `{}`",
              cf.bold(name),
              cf.bold(region),
          )
          kwargs.setdefault(
              "config",
              Config(retries={"max_attempts": max_retries}),
          )
          return boto3.client(
              name,
              region,
              **kwargs,
          )
  
file_path: ray/python/ray/autoscaler/_private/aws/utils.py
imports: from collections import defaultdict
  from functools import lru_cache
  import boto3
  from boto3.exceptions import ResourceNotExistsError
  from boto3.resources.base import ServiceResource
  from botocore.client import BaseClient
  from botocore.config import Config
  from ray.autoscaler._private.cli_logger import cf, cli_logger
  from ray.autoscaler._private.constants import BOTO_MAX_RETRIES
label_desc: Use image node_id 4 for calling a global function with example usage: client_cache(name, region, max_retries) and returns: resource_cache, boto3