code: def _encode_check_unknown(values, uniques, return_mask=False):
      """
      Helper function to check for unknowns in values to be encoded.
  
      Uses pure python method for object dtype, and numpy method for
      all other dtypes.
  
      Parameters
      ----------
      values : array
          Values to check for unknowns.
      uniques : array
          Allowed uniques values.
      return_mask : bool, default False
          If True, return a mask of the same shape as `values` indicating
          the valid values.
  
      Returns
      -------
      diff : list
          The unique values present in `values` and not in `uniques` (the
          unknown values).
      valid_mask : boolean array
          Additionally returned if ``return_mask=True``.
  
      """
      if values.dtype == object:
          uniques_set = set(uniques)
          diff = list(set(values) - uniques_set)
          if return_mask:
              if diff:
                  valid_mask = np.array(
                      [val in uniques_set for val in values]
                  )
              else:
                  valid_mask = np.ones(len(values), dtype=bool)
              return diff, valid_mask
          else:
              return diff
      else:
          unique_values = np.unique(values)
          diff = list(
              np.setdiff1d(unique_values, uniques, assume_unique=True)
          )
          if return_mask:
              if diff:
                  valid_mask = np.in1d(values, uniques)
              else:
                  valid_mask = np.ones(len(values), dtype=bool)
              return diff, valid_mask
          else:
              return diff
  
file_path: h2o-3/h2o-py/tests/pyunit_utils/sklearn_multinomial_auc_method.py
imports: import numpy
  from itertools import combinations
  from functools import partial
  from sklearn.utils import column_or_1d, check_consistent_length, check_array
  from sklearn.preprocessing import label_binarize
  from sklearn.metrics import auc, roc_curve
  from sklearn.utils.multiclass import type_of_target
label_desc: Use image node_id 1 for calling a global function with example usage: _encode_check_unknown(values, uniques, return_mask) and returns: diff,  valid_mask, diff, diff,  valid_mask, diff