code: def cohort_filter_json_converter(obj):
      """Helper function to convert CohortFilter object to json.
      :param obj: Object to convert to json.
      :type obj: object
      :return: The converted json.
      :rtype: dict
      """
      if isinstance(obj, CohortFilter):
          return obj.__dict__
      try:
          return obj.to_json()
      except AttributeError:
          return obj.__dict__
  
imports: import json
  from typing import Any, List, Optional
  import numpy
  import pandas
  from raiutils.exceptions import UserConfigValidationException
  from .constants import ClassificationOutcomes, CohortFilterMethods
label_desc: Use image node_id 1 for calling a global function with example usage: cohort_filter_json_converter(obj) and returns: obj, obj, obj