code: def _is_categorical(y: Union[ArrayLike, SeriesType]) -> bool:
      return isinstance(
          y, (dd.Series, pd.Series)
      ) and pd.api.types.is_categorical_dtype(y)
  
imports: from __future__ import division
  from operator import getitem
  from typing import Optional, Union
  import dask.array
  import dask.dataframe
  import numpy
  import pandas
  import scipy.sparse
  import sklearn.preprocessing
  from sklearn.utils.validation import check_is_fitted
  from .._typing import ArrayLike, SeriesType
label_desc: Use image node_id 6 for calling a global function with example usage: _is_categorical(y) and returns: unknown