code: def as_enum(d):
      if "__enum__" in d:
          name, member = d["__enum__"].split(".")
          return getattr(ModelType, member)
      else:
          return d
  
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 a global function with example usage: as_enum(d) and returns: getattr, d