code: def _validate_cohort_list(self, cohort_list=None):
      task_type = self.dashboard_input.dataset.task_type
      if task_type != ModelTask.FORECASTING and cohort_list is None:
          self.dashboard_input.cohortData = []
          return
  
      if task_type == ModelTask.FORECASTING:
          # Ensure user did not pass cohort_list and
          # use the generated time series.
          if cohort_list is not None:
              raise UserConfigValidationException(
                  "cohort_list is not supported for forecasting analysis."
              )
          # use generated time series
          cohort_list = self._generate_time_series_cohorts()
  
      if not isinstance(cohort_list, list):
          raise UserConfigValidationException(
              "cohort_list parameter should be a list."
          )
  
      if not all(isinstance(entry, Cohort) for entry in cohort_list):
          raise UserConfigValidationException(
              "All entries in cohort_list should be of type Cohort."
          )
  
      all_cohort_names = [cohort.name for cohort in cohort_list]
      unique_cohort_names = np.unique(all_cohort_names).tolist()
  
      if len(unique_cohort_names) != len(all_cohort_names):
          raise UserConfigValidationException(
              "Found cohorts with duplicate names. "
              "All pre-defined cohorts need to have distinct names."
          )
  
      test_data = pd.DataFrame(
          data=self.dashboard_input.dataset.features,
          columns=self.dashboard_input.dataset.feature_names,
      )
      if task_type == ModelTask.CLASSIFICATION:
          class_names_list = self.dashboard_input.dataset.class_names
          true_y_array = self.dashboard_input.dataset.true_y
          true_class_array = np.array(
              [class_names_list[index] for index in true_y_array]
          )
          test_data[
              self.dashboard_input.dataset.target_column
          ] = true_class_array
      else:
          test_data[
              self.dashboard_input.dataset.target_column
          ] = self.dashboard_input.dataset.true_y
  
      categorical_features = (
          self.dashboard_input.dataset.categorical_features
      )
      for cohort in cohort_list:
          cohort._validate_with_test_data(
              test_data=test_data,
              target_column=self.dashboard_input.dataset.target_column,
              categorical_features=categorical_features,
              is_classification=self._is_classifier,
          )
  
      self.dashboard_input.cohortData = cohort_list
  
imports: import traceback
  from typing import List, Optional
  import numpy
  import pandas
  from erroranalysis._internal.constants import display_name_to_metric
  from raiutils.cohort import Cohort, CohortFilter, CohortFilterMethods
  from raiutils.data_processing import convert_to_list, serialize_json_safe
  from raiutils.exceptions import UserConfigValidationException
  from raiutils.models import ModelTask, is_classifier
  from raiwidgets.constants import ErrorMessages
  from raiwidgets.error_handling import _format_exception
  from raiwidgets.interfaces import WidgetRequestResponseConstants
  from responsibleai import RAIInsights
  from responsibleai._internal.constants import ManagerNames
label_desc: Use image node_id 3 for calling the ResponsibleAIDashboardInput obj's underlying member method code with example usage: obj._validate_cohort_list(cohort_list) without return types