nodes: 0, module; 1, function_definition; 2, function_name:sort_index; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# sort_index can have ascending be None and behaves as if it is False.; 11, comment:# sort_values cannot have ascending be None. Thus, the following logic is to; 12, comment:# convert the ascending argument to one that works with sort_values; 13, expression_statement; 14, if_statement; 15, expression_statement; 16, function_definition; 17, expression_statement; 18, expression_statement; 19, if_statement; 20, return_statement; 21, identifier:kwargs; 22, comment:"""Sorts the data with respect to either the columns or the indices.
  
          Returns:
              DataManager containing the data sorted by columns or indices.
          """; 23, assignment; 24, assignment; 25, assignment; 26, comparison_operator:ascending is None; 27, block; 28, assignment; 29, function_name:sort_index_builder; 30, parameters; 31, block; 32, assignment; 33, assignment; 34, identifier:axis; 35, block; 36, else_clause; 37, call; 38, identifier:axis; 39, call; 40, identifier:index; 41, conditional_expression:self.columns if axis else self.index; 42, identifier:ascending; 43, call; 44, identifier:ascending; 45, None; 46, expression_statement; 47, subscript; 48, identifier:ascending; 49, identifier:df; 50, dictionary_splat_pattern; 51, if_statement; 52, return_statement; 53, identifier:func; 54, call; 55, identifier:new_data; 56, call; 57, expression_statement; 58, expression_statement; 59, block; 60, attribute; 61, argument_list; 62, attribute; 63, argument_list; 64, attribute; 65, identifier:axis; 66, attribute; 67, attribute; 68, argument_list; 69, assignment; 70, identifier:kwargs; 71, string:"ascending"; 72, identifier:kwargs; 73, identifier:axis; 74, block; 75, else_clause; 76, call; 77, attribute; 78, argument_list; 79, attribute; 80, argument_list; 81, assignment; 82, assignment; 83, expression_statement; 84, expression_statement; 85, identifier:self; 86, identifier:__constructor__; 87, identifier:new_data; 88, identifier:new_index; 89, identifier:new_columns; 90, call; 91, identifier:kwargs; 92, identifier:pop; 93, string:"axis"; 94, integer:0; 95, identifier:self; 96, identifier:columns; 97, identifier:self; 98, identifier:index; 99, identifier:kwargs; 100, identifier:pop; 101, string:"ascending"; 102, True; 103, identifier:ascending; 104, False; 105, expression_statement; 106, block; 107, attribute; 108, argument_list; 109, identifier:self; 110, identifier:_prepare_method; 111, identifier:sort_index_builder; 112, dictionary_splat; 113, identifier:self; 114, identifier:_map_across_full_axis; 115, identifier:axis; 116, identifier:func; 117, identifier:new_columns; 118, call; 119, identifier:new_index; 120, attribute; 121, assignment; 122, assignment; 123, attribute; 124, argument_list; 125, assignment; 126, expression_statement; 127, identifier:df; 128, identifier:sort_index; 129, keyword_argument; 130, dictionary_splat; 131, identifier:kwargs; 132, attribute; 133, argument_list; 134, identifier:self; 135, identifier:index; 136, identifier:new_index; 137, call; 138, identifier:new_columns; 139, attribute; 140, attribute; 141, identifier:copy; 142, attribute; 143, identifier:index; 144, assignment; 145, identifier:axis; 146, identifier:axis; 147, identifier:kwargs; 148, call; 149, identifier:sort_values; 150, dictionary_splat; 151, attribute; 152, argument_list; 153, identifier:self; 154, identifier:columns; 155, identifier:self; 156, identifier:dtypes; 157, identifier:df; 158, identifier:columns; 159, attribute; 160, identifier:index; 161, attribute; 162, argument_list; 163, identifier:kwargs; 164, call; 165, identifier:sort_values; 166, dictionary_splat; 167, identifier:df; 168, identifier:index; 169, identifier:pandas; 170, identifier:Series; 171, attribute; 172, attribute; 173, argument_list; 174, identifier:kwargs; 175, identifier:self; 176, identifier:columns; 177, identifier:pandas; 178, identifier:Series; 179, attribute; 180, identifier:self; 181, identifier:index
code: def sort_index(self, **kwargs):
          """Sorts the data with respect to either the columns or the indices.
  
          Returns:
              DataManager containing the data sorted by columns or indices.
          """
          axis = kwargs.pop("axis", 0)
          index = self.columns if axis else self.index
  
          # sort_index can have ascending be None and behaves as if it is False.
          # sort_values cannot have ascending be None. Thus, the following logic is to
          # convert the ascending argument to one that works with sort_values
          ascending = kwargs.pop("ascending", True)
          if ascending is None:
              ascending = False
          kwargs["ascending"] = ascending
  
          def sort_index_builder(df, **kwargs):
              if axis:
                  df.columns = index
              else:
                  df.index = index
              return df.sort_index(axis=axis, **kwargs)
  
          func = self._prepare_method(sort_index_builder, **kwargs)
          new_data = self._map_across_full_axis(axis, func)
          if axis:
              new_columns = pandas.Series(self.columns).sort_values(**kwargs)
              new_index = self.index
          else:
              new_index = pandas.Series(self.index).sort_values(**kwargs)
              new_columns = self.columns
          return self.__constructor__(
              new_data, new_index, new_columns, self.dtypes.copy()
          )