code: def _as_bytes(hash_data: Union[str, int, bytes]) -> bytes:
      """
      Returns the input hash_data in its bytes form
  
      Args:
      hash_data: the hash salt/key to be converted to bytes
      """
      if isinstance(hash_data, bytes):
          # Data already in bytes, returns as it as
          return hash_data
      elif isinstance(hash_data, str):
          # We keep the data as it as for it ot be later encoded to UTF-8
          # However replace `\\` with `/` for Windows compatibility
          hash_data = hash_data.replace("\\", "/")
      elif isinstance(hash_data, int):
          hash_data = str(hash_data)
      else:
          # If data is not of the required type, raise error
          raise InvalidKeyError(hash_data)
  
      return hash_data.encode("utf-8")
  
file_path: datasets/src/datasets/keyhash.py
imports: from typing import Union
  from huggingface_hub.utils import insecure_hashlib
label_desc: Use image node_id 1 for calling a global function with example usage: _as_bytes(hash_data) and returns: hash_data, hash_data