code: def replace_enum_to_str(obj):
      """
      Transform BetterEnum type into string.
  
      :param obj: Target obj.
      :return: Transformed obj with string type values.
      """
      for k, v in obj.items():
          if isinstance(v, dict):
              obj[k] = replace_enum_to_str(v)
          elif isinstance(v, BetterEnum):
              obj[k] = str(v)
      return obj
  
imports: from enum import Enum, EnumMeta, Flag, IntEnum
  from typing import List, Union
label_desc: Use image node_id 1 for calling a global function with example usage: replace_enum_to_str(obj) and returns: obj