code: def _load_attribute(
      path: Union[str, Path],
      file_format: str,
  ) -> Any:
      if file_format == SerializationFormats.PICKLE:
          val = None
          try:
              with open(path, "rb") as f:
                  val = pickle.load(f)
          except Exception:
              model_load_err = (
                  "ERROR-LOADING-EXPLAINER: "
                  "There was an error loading the explainer. "
                  "Some of RAI dashboard features may not work."
              )
              warnings.warn(model_load_err, UserWarning)
          return val
      elif file_format == SerializationFormats.JSON:
          with open(path, "r") as f:
              return json.load(f)
      elif file_format == SerializationFormats.TEXT:
          with open(path, "r") as f:
              return f.read()
      else:
          raise ValueError(f"Invalid format {file_format}")
  
file_path: responsible-ai-toolbox/responsibleai/responsibleai/_tools/shared/attribute_serialization.py
imports: import json
  import pickle
  import warnings
  from pathlib import Path
  from typing import Any, List, Union
  from responsibleai._internal.constants import FileFormats
label_desc: Use image node_id 4 for calling a global function with example usage: _load_attribute(path, file_format) and returns: val, json, f