code: def _request_wrapper(
      method: HTTP_METHOD_T,
      url: str,
      *,
      follow_relative_redirects: bool = False,
      **params,
  ) -> requests.Response:
      """Wrapper around requests methods to follow relative redirects if `follow_relative_redirects=True` even when
      `allow_redirection=False`.
  
      Args:
          method (`str`):
              HTTP method, such as 'GET' or 'HEAD'.
          url (`str`):
              The URL of the resource to fetch.
          follow_relative_redirects (`bool`, *optional*, defaults to `False`)
              If True, relative redirection (redirection to the same site) will be resolved even when `allow_redirection`
              kwarg is set to False. Useful when we want to follow a redirection to a renamed repository without
              following redirection to a CDN.
          **params (`dict`, *optional*):
              Params to pass to `requests.request`.
      """
      # Recursively follow relative redirects
      if follow_relative_redirects:
          response = _request_wrapper(
              method=method,
              url=url,
              follow_relative_redirects=False,
              **params,
          )
  
          # If redirection, we redirect only relative paths.
          # This is useful in case of a renamed repository.
          if 300 <= response.status_code <= 399:
              parsed_target = urlparse(response.headers["Location"])
              if parsed_target.netloc == "":
                  # This means it is a relative 'location' headers, as allowed by RFC 7231.
                  # (e.g. '/path/to/resource' instead of 'http://domain.tld/path/to/resource')
                  # We want to follow this relative redirect !
                  #
                  # Highly inspired by `resolve_redirects` from requests library.
                  # See https://github.com/psf/requests/blob/main/requests/sessions.py#L159
                  next_url = (
                      urlparse(url)
                      ._replace(path=parsed_target.path)
                      .geturl()
                  )
                  return _request_wrapper(
                      method=method,
                      url=next_url,
                      follow_relative_redirects=True,
                      **params,
                  )
          return response
  
      # Perform request and return if status_code is not in the retry list.
      response = get_session().request(method=method, url=url, **params)
      hf_raise_for_status(response)
      return response
  
imports: import copy
  import fnmatch
  import inspect
  import io
  import json
  import os
  import re
  import shutil
  import stat
  import tempfile
  import time
  import uuid
  import warnings
  from contextlib import contextmanager
  from dataclasses import dataclass
  from functools import partial
  from pathlib import Path
  from typing import Any, BinaryIO, Dict, Generator, Literal, Optional, Tuple, Union
  from urllib.parse import quote, urlparse
  import requests
  from filelock import FileLock
  from huggingface_hub import constants
  from .None import __version__
  from .constants import DEFAULT_ETAG_TIMEOUT, DEFAULT_REQUEST_TIMEOUT, DEFAULT_REVISION, DOWNLOAD_CHUNK_SIZE, ENDPOINT, HF_HUB_CACHE, HF_HUB_DISABLE_SYMLINKS_WARNING, HF_HUB_DOWNLOAD_TIMEOUT, HF_HUB_ENABLE_HF_TRANSFER, HF_HUB_ETAG_TIMEOUT, HF_TRANSFER_CONCURRENCY, HUGGINGFACE_CO_URL_TEMPLATE, HUGGINGFACE_HEADER_X_LINKED_ETAG, HUGGINGFACE_HEADER_X_LINKED_SIZE, HUGGINGFACE_HEADER_X_REPO_COMMIT, HUGGINGFACE_HUB_CACHE, REPO_ID_SEPARATOR, REPO_TYPES, REPO_TYPES_URL_PREFIXES
  from .utils import EntryNotFoundError, FileMetadataError, GatedRepoError, LocalEntryNotFoundError, OfflineModeIsEnabled, RepositoryNotFoundError, RevisionNotFoundError, SoftTemporaryDirectory, build_hf_headers, get_fastai_version, get_fastcore_version, get_graphviz_version, get_jinja_version, get_pydot_version, get_session, get_tf_version, get_torch_version, hf_raise_for_status, is_fastai_available, is_fastcore_available, is_graphviz_available, is_jinja_available, is_pydot_available, is_tf_available, is_torch_available, logging, reset_sessions, tqdm, validate_hf_hub_args
  from .utils._deprecation import _deprecate_method
  from .utils._headers import _http_user_agent
  from .utils._runtime import _PY_VERSION
  from .utils._typing import HTTP_METHOD_T
  from .utils.insecure_hashlib import sha256
label_desc: Use image node_id 6 for calling a global function with example usage: _request_wrapper(method, url) and returns: response, response, _request_wrapper