code: def default(self, obj):
      if obj in [e for e in ModelType]:
          return {"__enum__": str(obj)}
      return json.JSONEncoder.default(self, obj)
  
imports: import json
  from enum import Enum
  from typing import Union
  from pyspark.sql import Column
  import pyspark.sql.functions
label_desc: Use image node_id 1 for calling the ModelTypeEncoder obj's underlying member method code with example usage: obj.default(obj) and returns: json, dict