code: def _check_X_target_col(
      X, target_col, types=None, type_hints=None, task=None
  ):
      if types is None:
          types = detect_types(X, type_hints=type_hints)
      if (
          not isinstance(target_col, str)
          and hasattr(target_col, "__len__")
          and len(target_col) > 1
      ):
          raise ValueError(
              "target_col should be a column in X, "
              "got {}".format(target_col)
          )
      if target_col not in X.columns:
          raise ValueError(
              "{} is not a valid column of X".format(target_col)
          )
  
      if X[target_col].nunique() < 2:
          raise ValueError(
              "Less than two classes present, {}, need at least two"
              " for classification.".format(X.loc[0, target_col])
          )
      # FIXME we get target types here with detect_types,
      # but in the estimator with type_of_target
      if task == "classification" and not (
          types.loc[target_col, "categorical"]
          or types.loc[target_col, "low_card_int_categorical"]
          or types.loc[target_col, "low_card_int_ordinal"]
      ):
          raise ValueError(
              "Type for target column {} detected as {},"
              " need categorical for classification.".format(
                  target_col, types.T.idxmax()[target_col]
              )
          )
      if task == "regression" and (
          not types.loc[target_col, "continuous"]
      ):
          raise ValueError(
              "Type for target column {} detected as {},"
              " need continuous for regression.".format(
                  target_col, types.T.idxmax()[target_col]
              )
          )
      return types
  
imports: from warnings import warn
  from functools import reduce
  import itertools
  import numpy
  import pandas
  import matplotlib.pyplot
  from matplotlib.axes import Axes
  from matplotlib.patches import Rectangle, Patch
  from matplotlib.ticker import EngFormatter
  from seaborn.utils import despine
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.metrics import roc_curve
  from sklearn.model_selection import cross_val_score, StratifiedShuffleSplit
  from ..preprocessing import detect_types
  from .._config import get_config
label_desc: Use image node_id 12 for calling a global function with example usage: _check_X_target_col(X, target_col, types, type_hints, task) and returns: types