nodes: 0, module; 1, function_definition; 2, function_name:unique; 3, parameters; 4, block; 5, identifier:ar; 6, expression_statement; 7, import_statement; 8, if_statement; 9, return_statement; 10, comment:r"""Find the unique elements of an array.
  
      It uses ``dask.array.unique`` if necessary.
  
      Args:
          ar (array_like): Input array.
  
      Returns:
          array_like: the sorted unique elements.
      """; 11, aliased_import; 12, call; 13, block; 14, call; 15, dotted_name; 16, identifier:da; 17, identifier:isinstance; 18, argument_list; 19, return_statement; 20, identifier:_unique; 21, argument_list; 22, identifier:dask; 23, identifier:array; 24, identifier:ar; 25, attribute; 26, call; 27, identifier:ar; 28, attribute; 29, identifier:Array; 30, attribute; 31, argument_list; 32, identifier:da; 33, identifier:core; 34, identifier:da; 35, identifier:unique; 36, identifier:ar
code: def unique(ar):
      r"""Find the unique elements of an array.
  
      It uses ``dask.array.unique`` if necessary.
  
      Args:
          ar (array_like): Input array.
  
      Returns:
          array_like: the sorted unique elements.
      """
  
      import dask.array as da
  
      if isinstance(ar, da.core.Array):
          return da.unique(ar)
  
      return _unique(ar)