code: def to_jsonable(obj: object) -> object:
      """Recursively convert an object to json-encodable form.
  
      This is not intended to round-trip, but rather provide an analysis-ready
      format for observability.  To avoid side affects, we pretty-print all but
      known types.
      """
      if isinstance(obj, (str, int, float, bool, type(None))):
          if isinstance(obj, int) and abs(obj) >= 2**63:
              return float(obj)
          return obj
      if isinstance(obj, (list, tuple, set, frozenset)):
          if isinstance(obj, tuple) and hasattr(obj, "_asdict"):
              return to_jsonable(
                  obj._asdict()
              )  # treat namedtuples as dicts
          return [to_jsonable(x) for x in obj]
      if isinstance(obj, dict):
          return {
              k if isinstance(k, str) else pretty(k): to_jsonable(v)
              for k, v in obj.items()
          }
  
      # Special handling for dataclasses, attrs, and pydantic classes
      if (
          (dcs := sys.modules.get("dataclasses"))
          and dcs.is_dataclass(obj)
          and not isinstance(obj, type)
      ):
          return to_jsonable(dataclass_asdict(obj))
      if attr.has(type(obj)):
          return to_jsonable(attr.asdict(obj, recurse=False))  # type: ignore
      if (pyd := sys.modules.get("pydantic")) and isinstance(
          obj, pyd.BaseModel
      ):
          return to_jsonable(obj.model_dump())
  
      # If all else fails, we'll just pretty-print as a string.
      return pretty(obj)
  
imports: import sys
  import threading
  from inspect import signature
  from typing import TYPE_CHECKING, Callable, Dict
  import attr
  from hypothesis.internal.cache import LRUReusedCache
  from hypothesis.internal.compat import dataclass_asdict
  from hypothesis.internal.floats import float_to_int
  from hypothesis.internal.reflection import proxies
  from hypothesis.vendor.pretty import pretty
label_desc: Use image node_id 6 for calling a global function with example usage: to_jsonable(obj) and returns: pretty, obj, unknown, unknown, to_jsonable, to_jsonable, to_jsonable, float, to_jsonable