code: def __validate_target(self):
      # self.logger.info("Validating target")
      target_column = self.etalon_def_checked.get(
          FileColumnMeaningType.TARGET.value, ""
      )
      target = self.data[target_column]
  
      if self.task_type == ModelTaskType.BINARY:
          if not is_integer_dtype(target):
              try:
                  target = target.astype("category").cat.codes
              except ValueError:
                  self.logger.exception(
                      "Failed to cast target to category codes for binary task type"
                  )
                  raise ValidationError(
                      bundle.get("dataset_invalid_target_type").format(
                          target.dtype
                      )
                  )
          target_classes_count = target.nunique()
          if target_classes_count != 2:
              msg = bundle.get("dataset_invalid_binary_target").format(
                  target_classes_count
              )
              self.logger.warning(msg)
              raise ValidationError(msg)
      elif self.task_type == ModelTaskType.MULTICLASS:
          if not is_integer_dtype(target):
              try:
                  target = (
                      self.data[target_column]
                      .astype("category")
                      .cat.codes
                  )
              except Exception:
                  self.logger.exception(
                      "Failed to cast target to category codes for multiclass task type"
                  )
                  raise ValidationError(
                      bundle.get(
                          "dataset_invalid_multiclass_target"
                      ).format(target.dtype)
                  )
      elif self.task_type == ModelTaskType.REGRESSION:
          if not is_float_dtype(target):
              try:
                  self.data[target_column] = self.data[
                      target_column
                  ].astype("float")
              except ValueError:
                  self.logger.exception(
                      "Failed to cast target to float for regression task type"
                  )
                  raise ValidationError(
                      bundle.get(
                          "dataset_invalid_regression_target"
                      ).format(target.dtype)
                  )
      elif self.task_type == ModelTaskType.TIMESERIES:
          if not is_float_dtype(target):
              try:
                  self.data[target_column] = self.data[
                      target_column
                  ].astype("float")
              except ValueError:
                  self.logger.exception(
                      "Failed to cast target to float for timeseries task type"
                  )
                  raise ValidationError(
                      bundle.get(
                          "dataset_invalid_timeseries_target"
                      ).format(target.dtype)
                  )
  
imports: import csv
  import hashlib
  import logging
  import tempfile
  import time
  from ipaddress import IPv4Address, IPv6Address, _BaseAddress, ip_address
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import pandas
  from pandas.api.types import is_bool_dtype
  from pandas.api.types import is_datetime64_any_dtype
  from pandas.api.types import is_float_dtype, is_integer_dtype, is_numeric_dtype, is_string_dtype
  from pandas.core.dtypes.common import is_period_dtype
  from upgini.errors import ValidationError
  from upgini.http import ProgressStage, SearchProgress, get_rest_client
  from upgini.metadata import EVAL_SET_INDEX, SYSTEM_COLUMNS, SYSTEM_RECORD_ID, TARGET, DataType, FeaturesFilter, FileColumnMeaningType, FileColumnMetadata, FileMetadata, FileMetrics, ModelTaskType, NumericInterval, RuntimeParameters, SearchCustomization
  from upgini.normalizer.phone_normalizer import PhoneNormalizer
  from upgini.resource_bundle import bundle
  from upgini.sampler.random_under_sampler import RandomUnderSampler
  from upgini.search_task import SearchTask
  from upgini.utils import combine_search_keys
  from upgini.utils.email_utils import EmailSearchKeyConverter
  from upgini.utils.warning_counter import WarningCounter
label_desc: Use image node_id 27 for calling the Dataset obj's underlying member method code with example usage: obj.__validate_target() without return types