code: def _encode_python(values, uniques=None, encode=False):
      # only used in _encode below, see docstring there for details
      if uniques is None:
          uniques = sorted(set(values))
          uniques = np.array(uniques, dtype=values.dtype)
      if encode:
          table = {val: i for i, val in enumerate(uniques)}
          try:
              encoded = np.array([table[v] for v in values])
          except KeyError as e:
              raise ValueError(
                  "y contains previously unseen labels: %s".format(
                      str(e)
                  )
              )
          return uniques, encoded
      else:
          return uniques
  
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 3 for calling a global function with example usage: _encode_python(values, uniques, encode) and returns: uniques,  encoded, uniques