nodes: 0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, if_statement; 13, identifier:return_indexer; 14, False; 15, identifier:ascending; 16, True; 17, comment:"""
          Return a sorted copy of the index.
  
          Return a sorted copy of the index, and optionally return the indices
          that sorted the index itself.
  
          Parameters
          ----------
          return_indexer : bool, default False
              Should the indices that would sort the index be returned.
          ascending : bool, default True
              Should the index values be sorted in an ascending order.
  
          Returns
          -------
          sorted_index : pandas.Index
              Sorted copy of the index.
          indexer : numpy.ndarray, optional
              The indices that the index itself was sorted by.
  
          See Also
          --------
          Series.sort_values : Sort values of a Series.
          DataFrame.sort_values : Sort values in a DataFrame.
  
          Examples
          --------
          >>> idx = pd.Index([10, 100, 1, 1000])
          >>> idx
          Int64Index([10, 100, 1, 1000], dtype='int64')
  
          Sort values in ascending order (default behavior).
  
          >>> idx.sort_values()
          Int64Index([1, 10, 100, 1000], dtype='int64')
  
          Sort values in descending order, and also get the indices `idx` was
          sorted by.
  
          >>> idx.sort_values(ascending=False, return_indexer=True)
          (Int64Index([1000, 100, 10, 1], dtype='int64'), array([3, 1, 0, 2]))
          """; 18, assignment; 19, not_operator; 20, block; 21, assignment; 22, identifier:return_indexer; 23, block; 24, else_clause; 25, identifier:_as; 26, call; 27, identifier:ascending; 28, expression_statement; 29, identifier:sorted_index; 30, call; 31, return_statement; 32, block; 33, attribute; 34, argument_list; 35, assignment; 36, attribute; 37, argument_list; 38, expression_list; 39, return_statement; 40, identifier:self; 41, identifier:argsort; 42, identifier:_as; 43, subscript; 44, identifier:self; 45, identifier:take; 46, identifier:_as; 47, identifier:sorted_index; 48, identifier:_as; 49, identifier:sorted_index; 50, identifier:_as; 51, slice; 52, unary_operator; 53, integer:1
code: def sort_values(self, return_indexer=False, ascending=True):
          """
          Return a sorted copy of the index.
  
          Return a sorted copy of the index, and optionally return the indices
          that sorted the index itself.
  
          Parameters
          ----------
          return_indexer : bool, default False
              Should the indices that would sort the index be returned.
          ascending : bool, default True
              Should the index values be sorted in an ascending order.
  
          Returns
          -------
          sorted_index : pandas.Index
              Sorted copy of the index.
          indexer : numpy.ndarray, optional
              The indices that the index itself was sorted by.
  
          See Also
          --------
          Series.sort_values : Sort values of a Series.
          DataFrame.sort_values : Sort values in a DataFrame.
  
          Examples
          --------
          >>> idx = pd.Index([10, 100, 1, 1000])
          >>> idx
          Int64Index([10, 100, 1, 1000], dtype='int64')
  
          Sort values in ascending order (default behavior).
  
          >>> idx.sort_values()
          Int64Index([1, 10, 100, 1000], dtype='int64')
  
          Sort values in descending order, and also get the indices `idx` was
          sorted by.
  
          >>> idx.sort_values(ascending=False, return_indexer=True)
          (Int64Index([1000, 100, 10, 1], dtype='int64'), array([3, 1, 0, 2]))
          """
          _as = self.argsort()
          if not ascending:
              _as = _as[::-1]
  
          sorted_index = self.take(_as)
  
          if return_indexer:
              return sorted_index, _as
          else:
              return sorted_index