code: def stringify(d, _cls=None):
      """Converts unsafe JSON types to strings
  
      Args:
          d: serializable data
  
      Returns:
          a stringified version of the data
      """
      if dataclasses.is_dataclass(d):
          d = dataclasses.asdict(d)
  
      if isinstance(d, dict):
          for k in d:
              d[k] = stringify(d[k], d.get("_cls", None))
          return d
  
      if isinstance(d, tuple):
          return (stringify(v) for v in d)
  
      if isinstance(d, list):
          for i, v in enumerate(d):
              d[i] = stringify(v)
  
          return d
  
      if isinstance(d, bytes):
          try:
              # historically, bytes were used for numpy arrays
              return _handle_numpy_array(d, _cls)
          except:
              # with plugins, bytes can represent other data, omit for non
              return str(d)
  
      elif isinstance(d, (date, datetime)):
          return _handle_date(d)
      elif isinstance(d, ObjectId):
          return str(d)
      elif _is_invalid_number(d):
          return str(d)
  
      return d
  
file_path: fiftyone/fiftyone/core/json.py
imports: import dataclasses
  from datetime import date, datetime
  import math
  from bson import ObjectId
  import numpy
  import fiftyone.core.utils
label_desc: Use image node_id 5 for calling a global function with example usage: stringify(d, _cls) and returns: d, d, unknown, d, _handle_numpy_array, _handle_date, str, str, str