code: def _unique(values, *, return_inverse=False, return_counts=False):
      """Helper function to find unique values with support for python objects.
  
      Uses pure python method for object dtype, and numpy method for
      all other dtypes.
  
      Parameters
      ----------
      values : ndarray
          Values to check for unknowns.
  
      return_inverse : bool, default=False
          If True, also return the indices of the unique values.
  
      return_counts : bool, default=False
          If True, also return the number of times each unique item appears in
          values.
  
      Returns
      -------
      unique : ndarray
          The sorted unique values.
  
      unique_inverse : ndarray
          The indices to reconstruct the original array from the unique array.
          Only provided if `return_inverse` is True.
  
      unique_counts : ndarray
          The number of times each of the unique values comes up in the original
          array. Only provided if `return_counts` is True.
      """
      if values.dtype == object:
          return _unique_python(
              values,
              return_inverse=return_inverse,
              return_counts=return_counts,
          )
      # numerical
      return _unique_np(
          values,
          return_inverse=return_inverse,
          return_counts=return_counts,
      )
  
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 1 for calling a global function with example usage: _unique(values) and returns: _unique_np, _unique_python