def METHOD_NAME(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().METHOD_NAME(obj)