<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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()
        )