code: def _type_of_target(y):
      is_sequence, is_array = isinstance(y, Sequence), hasattr(
          y, "__array__"
      )
      is_not_string, is_sparse = not isinstance(y, str), sp.issparse(y)
      valid = (is_sequence or is_array or is_sparse) and is_not_string
  
      if not valid:
          raise ValueError(
              "Expected array-like (array or non-string sequence), "
              "got %r" % y
          )
  
      sparse_pandas = y.__class__.__name__ in [
          "SparseSeries",
          "SparseArray",
      ]
      if sparse_pandas:
          raise ValueError(
              "y cannot be class 'SparseSeries' or 'SparseArray'"
          )
  
      if _is_multilabel(y):
          return "multilabel-indicator"
  
      # DeprecationWarning will be replaced by ValueError, see NEP 34
      # https://numpy.org/neps/nep-0034-infer-dtype-is-object.html
      with warnings.catch_warnings():
          warnings.simplefilter("error", np.VisibleDeprecationWarning)
          try:
              y = np.asarray(y)
          except np.VisibleDeprecationWarning:
              # dtype=object should be provided explicitly for ragged arrays,
              # see NEP 34
              y = np.asarray(y, dtype=object)
  
      # The old sequence of sequences format
      try:
          if (
              not hasattr(y[0], "__array__")
              and isinstance(y[0], Sequence)
              and not isinstance(y[0], str)
          ):
              raise ValueError(
                  "You appear to be using a legacy multi-label data"
                  " representation. Sequence of sequences are no"
                  " longer supported; use a binary array or sparse"
                  " matrix instead - the MultiLabelBinarizer"
                  " transformer can convert to this format."
              )
      except IndexError:
          pass
  
      # Invalid inputs
      if y.ndim > 2 or (
          y.dtype == object
          and len(y)
          and not isinstance(y.flat[0], str)
      ):
          return "unknown"  # [[[1, 2]]] or [obj_1] and not ["label_1"]
  
      if y.ndim == 2 and y.shape[1] == 0:
          return "unknown"  # [[]]
  
      if y.ndim == 2 and y.shape[1] > 1:
          suffix = "-multioutput"  # [[1, 2], [1, 2]]
      else:
          suffix = ""  # [1, 2, 3] or [[1], [2], [3]]
  
      # check float and contains non-integer float values
      if y.dtype.kind == "f" and np.any(y != y.astype(int)):
          # [.1, .2, 3] or [[.1, .2, 3]] or [[1., .2]] and not [1., 2., 3.]
          _assert_all_finite(y)
          return "continuous" + suffix
  
      if (len(np.unique(y)) > 2) or (y.ndim >= 2 and len(y[0]) > 1):
          return (
              "multiclass" + suffix
          )  # [1, 2, 3] or [[1., 2., 3]] or [[1, 2]]
      return "binary"
  
imports: import warnings
  from collections.abc import Sequence
  from numbers import Integral
  import numpy
  from scipy import sparse
  from sklearn.preprocessing import LabelEncoder
  from sklearn.utils.validation import check_array
  from daal4py.sklearn.utils.validation import _assert_all_finite
label_desc: Use image node_id 9 for calling a global function with example usage: _type_of_target(y) and returns: str, str, str, str, unknown, unknown