code: def _save_attribute(
      value: Any,
      path: Union[str, Path],
      file_format: str,
  ) -> None:
      if file_format == SerializationFormats.PICKLE:
          with open(path, "wb") as f:
              pickle.dump(value, f)
      elif file_format == SerializationFormats.JSON:
          with open(path, "w") as f:
              json.dump(value, f)
      elif file_format == SerializationFormats.TEXT:
          with open(path, "w") as f:
              f.write(value)
      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 2 for calling a global function with example usage: _save_attribute(value, path, file_format) without return types