code: def _check_col(col, df, is_target=True):
      """
      Validate column and return its type.
  
      Parameters
      ----------
      col : str or list of str
          The column name(s) in the input DataFrame.
      df : pandas.DataFrame
          The input DataFrame containing the columns to validate.
      is_target : bool, default=True
          If True, the column is treated as a target column. Otherwise, it's treated as a feature column.
  
      Returns
      -------
      str
          The determined type of the column.
          For target columns, possible values are: "binary", "multi-class", "regression".
          For feature columns, possible values are: "binary", "onehot", "numeric".
  
      Raises
      ------
      ValueError
          If the provided column(s) is not found in the input DataFrame or does not meet the expected format.
      """
  
      def _validate_cols(cols, df_cols, name):
          missing_cols = cols - df_cols
          if missing_cols:
              raise ValueError(f"{name} does not exist: {missing_cols}")
          return True
  
      df_cols = set(df.columns)
      name = "target" if is_target else "feature"
  
      if isinstance(col, list):
          if len(col) <= 1:
              raise ValueError(
                  f"a list of {name} should contain more than 1 element, "
                  f"please provide the full list or just use the single element"
              )
  
          _validate_cols(set(col), df_cols, name)
  
          unique_values = set(np.unique(df[col].values))
          if unique_values != {0, 1}:
              raise ValueError(
                  f"one-hot encoded {name} should only contain 0 or 1"
              )
  
          if is_target:
              col_type = "multi-class"
          else:
              if set(df[col].sum(axis=1).unique()) != {1}:
                  raise ValueError(f"{name} should be one-hot encoded")
              col_type = "onehot"
      else:
          _validate_cols({col}, df_cols, name)
  
          unique_values = set(np.unique(df[col].values))
          if unique_values == {0, 1}:
              col_type = "binary"
          else:
              col_type = "regression" if is_target else "numeric"
  
      return col_type
  
imports: import numpy
  import pandas
  import psutil
label_desc: Use image node_id 2 for calling a global function with example usage: _check_col(col, df, is_target) and returns: col_type, True