code: def http_user_agent(user_agent: Union[Dict, str, None] = None) -> str:
      """
      Formats a user-agent string with basic info about a request.
      """
      ua = f"diffusers/{__version__}; python/{sys.version.split()[0]}; session_id/{SESSION_ID}"
      if HF_HUB_DISABLE_TELEMETRY or HF_HUB_OFFLINE:
          return ua + "; telemetry/off"
      if is_torch_available():
          ua += f"; torch/{_torch_version}"
      if is_flax_available():
          ua += f"; jax/{_jax_version}"
          ua += f"; flax/{_flax_version}"
      if is_onnx_available():
          ua += f"; onnxruntime/{_onnxruntime_version}"
      # CI will set this value to True
      if (
          os.environ.get("DIFFUSERS_IS_CI", "").upper()
          in ENV_VARS_TRUE_VALUES
      ):
          ua += "; is_ci/true"
      if isinstance(user_agent, dict):
          ua += "; " + "; ".join(
              f"{k}/{v}" for k, v in user_agent.items()
          )
      elif isinstance(user_agent, str):
          ua += "; " + user_agent
      return ua
  
imports: import os
  import re
  import sys
  import tempfile
  import traceback
  import warnings
  from pathlib import Path
  from typing import Dict, Optional, Union
  from uuid import uuid4
  from huggingface_hub import ModelCard, ModelCardData, create_repo, get_full_repo_name, hf_hub_download, upload_folder
  from huggingface_hub.constants import HF_HUB_CACHE, HF_HUB_DISABLE_TELEMETRY, HF_HUB_OFFLINE
  from huggingface_hub.file_download import REGEX_COMMIT_HASH
  from huggingface_hub.utils import EntryNotFoundError, RepositoryNotFoundError, RevisionNotFoundError, is_jinja_available, validate_hf_hub_args
  from packaging import version
  from requests import HTTPError
  from ..None import __version__
  from .constants import DEPRECATED_REVISION_ARGS, HUGGINGFACE_CO_RESOLVE_ENDPOINT, SAFETENSORS_WEIGHTS_NAME, WEIGHTS_NAME
  from .import_utils import ENV_VARS_TRUE_VALUES, _flax_version, _jax_version, _onnxruntime_version, _torch_version, is_flax_available, is_onnx_available, is_torch_available
  from .logging import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: http_user_agent(user_agent) and returns: ua, unknown