code: def default(self, o):  # pylint: disable=E0202
      try:
          if isinstance(o, Enum):
              return getattr(o, "_name_")
          if hasattr(o, "__dict__"):
              return vars(o)
          if hasattr(o, "__slots__"):
              ret = {slot: getattr(o, slot) for slot in o.__slots__}
              for cls in type(o).mro():
                  spr = super(cls, o)
                  if not hasattr(spr, "__slots__"):
                      break
                  for slot in spr.__slots__:
                      ret[slot] = getattr(o, slot)
              return ret
      except Exception as e:
          print(e)
      return None
  
imports: import json
  from enum import Enum
  from json import JSONEncoder
label_desc: Use image node_id 1 for calling the SentimentDocEncoder obj's underlying member method code with example usage: obj.default(o) and returns: None, getattr, vars, ret