code: def tree(obj):
      """
      Convert object to a tree of lists, dicts and simple values.
      The result can be serialized to JSON.
      """
      if isinstance(obj, (bool, int, float, str, bytes)):
          return obj
      elif isinstance(obj, (dt.date, dt.time)):
          return obj.isoformat()
      elif isinstance(obj, dict):
          return {k: tree(v) for k, v in obj.items()}
      elif isnamedtupleinstance(obj):
          return {f: tree(getattr(obj, f)) for f in obj._fields}
      elif isinstance(obj, (list, tuple, set)):
          return [tree(i) for i in obj]
      elif is_dataclass(obj):
          return {
              obj.__class__.__qualname__: tree(
                  dataclassNonDefaults(obj)
              )
          }
      else:
          return str(obj)
  
imports: import asyncio
  import datetime
  import logging
  import math
  import signal
  import sys
  import time
  from dataclasses import fields, is_dataclass
  from typing import AsyncIterator, Awaitable, Callable, Iterator, List, Optional, Union
  import eventkit
label_desc: Use image node_id 8 for calling a global function with example usage: tree(obj) and returns: obj, obj, unknown, unknown, unknown, dict, str