code: def _validate_token_to_send(
      token: Optional[str], is_write_action: bool
  ) -> None:
      if is_write_action:
          if token is None:
              raise ValueError(
                  "Token is required (write-access action) 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."
              )
          if token.startswith("api_org"):
              raise ValueError(
                  "You must use your personal account token for write-access methods. To"
                  " generate a write-access token, go to"
                  " https://huggingface.co/settings/tokens"
              )
  
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 3 for calling a global function with example usage: _validate_token_to_send(token, is_write_action) without return types