code: def check_y(y, data, verbose):
      if y is None:
          verbose_cat(
              "  -> target variable   : Not specified!", verbose=verbose
          )
      else:
          if isinstance(y, pd.Series):
              y = np.array(y)
              verbose_cat(
                  "  -> target variable   : Parameter 'y' was a pandas.Series. Converted to a numpy.ndarray.",
                  verbose=verbose,
              )
          elif isinstance(y, pd.DataFrame):
              if y.shape[1] != 1:
                  raise ValueError("'y' must be only one column")
              y = y.to_numpy().flatten()
              verbose_cat(
                  "  -> target variable   : Parameter 'y' was a pandas.DataFrame. Converted to a numpy.ndarray.",
                  verbose=verbose,
              )
          elif type(y).__name__ == "H2OFrame":  # can't import h2o
              verbose_cat(
                  "  -> target variable   : Parameter 'y' was a h2o.H2OFrame. Converted to a numpy.ndarray.",
                  verbose=verbose,
              )
              y = y.as_data_frame().to_numpy().flatten()
          elif isinstance(y, np.ndarray) and len(y.shape) != 1:
              raise ValueError("'y' must have only one dimension")
          elif not isinstance(y, np.ndarray):
              raise TypeError(
                  "'y' must be a numpy.ndarray (1d) or pandas.Series"
              )
  
          verbose_cat(
              "  -> target variable   : " + str(y.shape[0]) + " values",
              verbose=verbose,
          )
  
          if isinstance(y[0], str):
              verbose_cat(
                  "  -> target variable   : Please note that 'y' is a string array.",
                  verbose=verbose,
              )
              verbose_cat(
                  "  -> target variable   : 'y' should be a numeric or boolean array.",
                  verbose=verbose,
              )
              verbose_cat(
                  "  -> target variable   : Otherwise an Error may occur in calculating residuals or loss.",
                  verbose=verbose,
              )
  
          if data is not None:
              if y.shape[0] != data.shape[0]:
                  verbose_cat(
                      "  -> target variable   : Length of 'y' is different than the number of rows in 'data'.",
                      verbose=verbose,
                  )
  
              if is_y_in_data(data, y):
                  verbose_cat(
                      "  -> data              : A column identical to the target variable"
                      + " `y` has been found in the `data`.",
                      verbose=verbose,
                  )
                  verbose_cat(
                      "  -> data              : It is highly recommended to pass `data` without"
                      + " the target variable column.",
                      verbose=verbose,
                  )
  
      return y
  
imports: import numpy
  import pandas
  from copy import deepcopy
  from warnings import warn
  from .helper import verbose_cat, is_y_in_data, get_model_info
  from .yhat import get_predict_function_and_model_type
label_desc: Use image node_id 4 for calling a global function with example usage: check_y(y, data, verbose) and returns: y