code: def _encode(self, obj: Any) -> AnyRep:
      if isinstance(obj, Model):
  
          def query(prop: PropertyDescriptor[Any]) -> bool:
              return prop.readonly or prop.serialized
  
          properties = obj.query_properties_with_values(
              query, include_defaults=False, include_undefined=True
          )
          attributes = {
              key: self.encode(val) for key, val in properties.items()
          }
          rep = ObjectRep(
              type="object",
              name=obj.__qualified_model__,
              attributes=attributes,
          )
          return rep
      elif obj is Undefined:
          return SymbolRep(type="symbol", name="unset")
      else:
          return super()._encode(obj)
  
file_path: bokeh/tests/support/defaults.py
imports: from __future__ import annotations
  import logging
  import os
  import warnings
  from pathlib import Path
  from typing import Any
  import json5
  from bokeh.core.has_props import HasProps
  from bokeh.core.property.descriptors import PropertyDescriptor
  from bokeh.core.property.singletons import Undefined
  from bokeh.core.serialization import AnyRep, ObjectRep, Serializer, SymbolRep
  from bokeh.model import Model
  from bokeh.util.warnings import BokehDeprecationWarning
label_desc: Use image node_id 1 for calling the DefaultsSerializer obj's underlying member method code with example usage: obj._encode(obj) and returns: rep, unknown, SymbolRep, super