code: def _check_and_search_block(
      arr, uniques, onehot_dtype=None, block_info=None
  ):
      diff = list(np.setdiff1d(arr, uniques, assume_unique=True))
  
      if diff:
          msg = (
              "Block contains previously unseen values {}.\nBlock info:\n\n"
              "{}".format(diff, block_info)
          )
          raise ValueError(msg)
  
      label_encoded = np.searchsorted(uniques, arr)
      if onehot_dtype:
          return _construct(label_encoded, uniques)
      else:
          return label_encoded
  
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 2 for calling a global function with example usage: _check_and_search_block(arr, uniques, onehot_dtype, block_info) and returns: _construct, label_encoded