docstr: Take a transform pipeline and convert it to a serializable representation that uses only standard
  python data types: dictionaries, lists, strings, integers, and floats.
  
  Args:
      self: A transform that should be serialized. If the transform doesn't implement the `to_dict`
          method and `on_not_implemented_error` equals to 'raise' then `NotImplementedError` is raised.
          If `on_not_implemented_error` equals to 'warn' then `NotImplementedError` will be ignored
          but no transform parameters will be serialized.
      on_not_implemented_error (str): `raise` or `warn`.
docstr_tok: ["Take","a","transform","pipeline","and","convert","it","to","a","serializable","representation","that","uses","only","standard","python","data","types",":","dictionaries",",","lists",",","strings",",","integers",",","and","floats",".","Args",":","self",":","A","transform","that","should","be","serialized",".","If","the","transform","does","n't","implement","the","`","to_dict","`","method","and","`","on_not_implemented_error","`","equals","to","'raise","'","then","`","NotImplementedError","`","is","raised",".","If","`","on_not_implemented_error","`","equals","to","'warn","'","then","`","NotImplementedError","`","will","be","ignored","but","no","transform","parameters","will","be","serialized",".","on_not_implemented_error","(","str",")",":","`","raise","`","or","`","warn","`","."]
code: def to_dict(
      self, on_not_implemented_error: str = "raise"
  ) -> Dict[str, Any]:
      """
      Take a transform pipeline and convert it to a serializable representation that uses only standard
      python data types: dictionaries, lists, strings, integers, and floats.
  
      Args:
          self: A transform that should be serialized. If the transform doesn't implement the `to_dict`
              method and `on_not_implemented_error` equals to 'raise' then `NotImplementedError` is raised.
              If `on_not_implemented_error` equals to 'warn' then `NotImplementedError` will be ignored
              but no transform parameters will be serialized.
          on_not_implemented_error (str): `raise` or `warn`.
      """
      if on_not_implemented_error not in {"raise", "warn"}:
          raise ValueError(
              "Unknown on_not_implemented_error value: {}. Supported values are: 'raise' and 'warn'".format(
                  on_not_implemented_error
              )
          )
      try:
          transform_dict = self._to_dict()
      except NotImplementedError as e:
          if on_not_implemented_error == "raise":
              raise e
  
          transform_dict = {}
          warnings.warn(
              "Got NotImplementedError while trying to serialize {obj}. Object arguments are not preserved. "
              "Implement either '{cls_name}.get_transform_init_args_names' or '{cls_name}.get_transform_init_args' "
              "method to make the transform serializable".format(
                  obj=self, cls_name=self.__class__.__name__
              )
          )
      return {"__version__": __version__, "transform": transform_dict}
  
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 4 for calling the Serializable obj's underlying member method code with example usage: obj.to_dict(on_not_implemented_error) and returns: dict