code: def save(
      transform: Serializable,
      filepath: str,
      data_format: str = "json",
      on_not_implemented_error: str = "raise",
  ) -> None:
      """
      Take a transform pipeline, serialize it and save a serialized version to a file
      using either json or yaml format.
  
      Args:
          transform (obj): Transform to serialize.
          filepath (str): Filepath to write to.
          data_format (str): Serialization format. Should be either `json` or 'yaml'.
          on_not_implemented_error (str): Parameter that describes what to do if a transform doesn't implement
              the `to_dict` method. If 'raise' then `NotImplementedError` is raised, if `warn` then the exception will be
              ignored and no transform arguments will be saved.
      """
      check_data_format(data_format)
      transform_dict = transform.to_dict(
          on_not_implemented_error=on_not_implemented_error
      )
      dump_fn = json.dump if data_format == "json" else yaml.safe_dump
      with open(filepath, "w") as f:
          dump_fn(transform_dict, f)
  
imports: from __future__ import absolute_import
  import json
  import typing
  import warnings
  from abc import ABC, ABCMeta, abstractmethod
  from typing import IO, Any, Callable, Dict, Optional, Tuple, Type, Union
  from albumentations import __version__
label_desc: Use image node_id 7 for calling a global function with example usage: save(transform, filepath, data_format, on_not_implemented_error) without return types