class_docstr: This encoder serializes any object that has attr, dataclass or a custom serializer.
class_docstr_tok: ["This","encoder","serializes","any","object","that","has","attr",",","dataclass","or","a","custom","serializer","."]
code: def encode(self, o: Any) -> str:
      # checked here and in serialize
      if isinstance(o, dict) and (CLASSNAME in o or SCHEMA_ID in o):
          raise AttributeError(
              f"reserved key {CLASSNAME} found in dict to serialize"
          )
  
      # tuples are not preserved by std python serializer
      if isinstance(o, tuple):
          o = self.default(o)
  
      return super().encode(o)
  
imports: from __future__ import annotations
  import json
  from datetime import date, datetime
  from decimal import Decimal
  from typing import Any
  from flask.json.provider import JSONProvider
  from airflow.serialization.serde import CLASSNAME, DATA, SCHEMA_ID, deserialize, serialize
  from airflow.utils.timezone import convert_to_utc, is_naive
label_desc: Use image node_id 2 for calling the XComEncoder obj's underlying member method code with example usage: obj.encode(o) and returns: super