code: def to_disk(obj: "SerDe", path: Path):
      """Save `SerDe` object into `path` directory"""
      if not isinstance(obj, SerDe) or isinstance(obj, type):
          raise ValueError(f"{obj} doesn't implement `SerDe`")
  
      path.mkdir(exist_ok=True)
      # write metadata so that `from_disk` can get the class of `obj`
      module_name, class_name = _get_fullname(obj.__class__)
      meta = _Meta(module_name, class_name)
      meta.to_disk(path)
      # delegate to obj
      obj.to_disk(path)
  
imports: from dataclasses import dataclass, asdict
  import importlib
  import dataclass_utils.error
  import pickle
  from pathlib import Path
  from typing import Any, ClassVar, List, Tuple, Type, TypeVar
  import dataclass_utils
  from typing_extensions import Protocol, runtime_checkable
  import json
label_desc: Use image node_id 1 for calling a global function with example usage: to_disk(obj, path) without return types