code: def _unique_python(values, *, return_inverse, return_counts):
      # Only used in `_uniques`, see docstring there for details
      try:
          uniques_set = set(values)
          uniques_set, missing_values = _extract_missing(uniques_set)
  
          uniques = sorted(uniques_set)
          uniques.extend(missing_values.to_list())
          uniques = np.array(uniques, dtype=values.dtype)
      except TypeError:
          types = sorted(
              t.__qualname__ for t in set(type(v) for v in values)
          )
          raise TypeError(
              "Encoders require their input argument must be uniformly "
              f"strings or numbers. Got {types}"
          )
      ret = (uniques,)
  
      if return_inverse:
          ret += (_map_to_integer(values, uniques),)
  
      if return_counts:
          ret += (_get_counts(values, uniques),)
  
      return ret[0] if len(ret) == 1 else ret
  
imports: from collections import Counter
  from contextlib import suppress
  from typing import NamedTuple
  import numpy
  from .None import is_scalar_nan
label_desc: Use image node_id 5 for calling a global function with example usage: _unique_python(values) and returns: unknown