code: def get_remote_tmpdir(
      caller_name: str,
      *,
      bucket: Optional[str] = None,
      remote_tmpdir: Optional[str] = None,
      user_config: Optional[configparser.ConfigParser] = None,
      warnings_stacklevel: int = 2,
  ) -> str:
      if user_config is None:
          user_config = get_user_config()
  
      if bucket is not None:
          warnings.warn(
              f"Use of deprecated argument 'bucket' in {caller_name}(...). Specify 'remote_tmpdir' as a keyword argument instead.",
              stacklevel=warnings_stacklevel,
          )
  
      if remote_tmpdir is not None and bucket is not None:
          raise ValueError(
              f"Cannot specify both 'remote_tmpdir' and 'bucket' in {caller_name}(...). Specify 'remote_tmpdir' as a keyword argument instead."
          )
  
      if bucket is None and remote_tmpdir is None:
          remote_tmpdir = configuration_of(
              ConfigVariable.BATCH_REMOTE_TMPDIR, None, None
          )
  
      if remote_tmpdir is None:
          if bucket is None:
              bucket = user_config.get("batch", "bucket", fallback=None)
              warnings.warn(
                  "Using deprecated configuration setting 'batch/bucket'. Run `hailctl config set batch/remote_tmpdir` "
                  "to set the default for 'remote_tmpdir' instead.",
                  stacklevel=warnings_stacklevel,
              )
          if bucket is None:
              raise ValueError(
                  f"Either the 'remote_tmpdir' parameter of {caller_name}(...) must be set or you must "
                  "run `hailctl config set batch/remote_tmpdir REMOTE_TMPDIR`."
              )
          if "gs://" in bucket:
              raise ValueError(
                  f"The bucket parameter to {caller_name}(...) and the `batch/bucket` hailctl config setting "
                  "must both be bucket names, not paths. Use the remote_tmpdir parameter or batch/remote_tmpdir "
                  "hailctl config setting instead to specify a path."
              )
          remote_tmpdir = f"gs://{bucket}/batch"
      else:
          schemes = {"gs", "hail-az", "https"}
          found_scheme = any(
              remote_tmpdir.startswith(f"{scheme}://")
              for scheme in schemes
          )
          if not found_scheme:
              raise ValueError(
                  f"remote_tmpdir must be a storage uri path like gs://bucket/folder. Received: {remote_tmpdir}. Possible schemes include gs for GCP and https for Azure"
              )
      if remote_tmpdir[-1] != "/":
          remote_tmpdir += "/"
      return remote_tmpdir
  
file_path: hail/hail/python/hailtop/config/user_config.py
imports: from typing import Optional, Union, TypeVar
  import os
  import re
  import configparser
  import warnings
  from pathlib import Path
  from .variables import ConfigVariable
label_desc: Use image node_id 8 for calling a global function with example usage: get_remote_tmpdir(caller_name) and returns: remote_tmpdir