code: def read_file(
      path: Union[str, Path], mode: str = "r"
  ) -> Union[str, bytes]:
      """Reads a file and returns its content.
  
      Args:
        path: The file path to read from.
        mode: The mode to open the file in. Defaults to 'r'.
  
      Raises:
        FileNotFoundError: If the file does not exist.
        ValueError: If an invalid mode is provided.
      """
      if not os.path.exists(path):
          raise FileNotFoundError(f"File {path} does not exist.")
  
      with open(path, mode) as f:
          return f.read()
  
file_path: model-card-toolkit/model_card_toolkit/utils/io_utils.py
imports: import os
  from pathlib import Path
  from typing import Union
  from google.protobuf.message import Message
label_desc: Use image node_id 4 for calling a global function with example usage: read_file(path, mode) and returns: f