code: def get_token_to_send(
      token: Optional[Union[bool, str]]
  ) -> Optional[str]:
      """Select the token to send from either `token` or the cache."""
      # Case token is explicitly provided
      if isinstance(token, str):
          return token
  
      # Case token is explicitly forbidden
      if token is False:
          return None
  
      # Token is not provided: we get it from local cache
      cached_token = get_token()
  
      # Case token is explicitly required
      if token is True:
          if cached_token is None:
              raise LocalTokenNotFoundError(
                  "Token is required (`token=True`), but no token found. You"
                  " need to provide a token or be logged in to Hugging Face with"
                  " `huggingface-cli login` or `huggingface_hub.login`. See"
                  " https://huggingface.co/settings/tokens."
              )
          return cached_token
  
      # Case implicit use of the token is forbidden by env variable
      if constants.HF_HUB_DISABLE_IMPLICIT_TOKEN:
          return None
  
      # Otherwise: we use the cached token as the user has not explicitly forbidden it
      return cached_token
  
file_path: huggingface_hub/src/huggingface_hub/utils/_headers.py
imports: from typing import Dict, Optional, Union
  from ..None import constants
  from ._runtime import get_fastai_version, get_fastcore_version, get_hf_hub_version, get_python_version, get_tf_version, get_torch_version, is_fastai_available, is_fastcore_available, is_tf_available, is_torch_available
  from ._token import get_token
  from ._validators import validate_hf_hub_args
label_desc: Use image node_id 2 for calling a global function with example usage: get_token_to_send(token) and returns: cached_token, token, None, cached_token, None