code: def default_json_write(obj):
      """Convert values that are not JSON-friendly to a more acceptable type
  
      Parameters
      ----------
      obj: Object
          The object that is expected to be of a type that is incompatible with JSON files
  
      Returns
      -------
      Object
          The value of `obj` after being cast to a type accepted by JSON
  
      Raises
      ------
      TypeError
          If the type of `obj` is unhandled
  
      Examples
      --------
      >>> assert default_json_write(np.array([1, 2, 3])) == [1, 2, 3]
      >>> assert default_json_write(np.int8(32)) == 32
      >>> assert np.isclose(default_json_write(np.float16(3.14)), 3.14, atol=0.001)
      >>> assert default_json_write(pd.Index(["a", "b", "c"])) == ["a", "b", "c"]
      >>> assert default_json_write((1, 2)) == {"__tuple__": [1, 2]}
      >>> default_json_write(object())  # doctest: +ELLIPSIS
      Traceback (most recent call last):
          File "file_utils.py", line ?, in default_json_write
      TypeError: <object object at ...> is not JSON serializable"""
      #################### Builtin Types ####################
      if isinstance(obj, tuple):
          return {"__tuple__": list(obj)}
      #################### NumPy Types ####################
      if isinstance(obj, np.ndarray):
          return obj.tolist()
      if isinstance(obj, np.integer):
          return int(obj)
      if isinstance(obj, np.floating):
          return float(obj)
      #################### Pandas Types ####################
      if isinstance(obj, pd.Index):
          return list(obj)
  
      raise TypeError(f"{obj!r} is not JSON serializable")
  
imports: from hyperparameter_hunter.settings import G
  from contextlib import suppress
  from inspect import signature
  import numpy
  import os
  import os.path
  import pandas
  import simplejson
  from typing import Union
  import wrapt
label_desc: Use image node_id 1 for calling a global function with example usage: default_json_write(obj) and returns: dict, obj, int, float, list