code: def diff(
      config1: ConfigBase,
      config2: ConfigBase,
      from_: str = "",
      to_: str = "",
  ) -> str:
      # This method is not to get an accurate diff, but to give users a rough idea of what is changed.
      import difflib
      import pprint
  
      # The ideal diff should directly apply on the pprint of dataclass. However,
      #  1. pprint of dataclass is not stable. It actually changes from python 3.9 to 3.10.
      #  2. MISSING doesn't have a stable memory address. It might be different in different objects.
  
      str1, str2 = pprint.pformat(config1.json()), pprint.pformat(
          config2.json()
      )
  
      return "\n".join(
          difflib.unified_diff(
              str1.splitlines(),
              str2.splitlines(),
              from_,
              to_,
              lineterm="",
          )
      )
  
imports: from __future__ import annotations
  import copy
  import dataclasses
  import importlib
  import json
  import os.path
  from pathlib import Path
  import socket
  from typing import TYPE_CHECKING, get_type_hints
  import typeguard
  import nni.runtime.config
  from .public import is_missing
label_desc: Use image node_id 18 for calling a global function with example usage: diff(config1, config2, from_, to_) and returns: str