code: def sort_values(self, inplace=False, ascending=True, na_position='last'):
          inplace = validate_bool_kwarg(inplace, 'inplace')
          if na_position not in ['last', 'first']:
              msg = 'invalid na_position: {na_position!r}'
              raise ValueError(msg.format(na_position=na_position))
          sorted_idx = nargsort(self,
                                ascending=ascending,
                                na_position=na_position)
          if inplace:
              self._codes = self._codes[sorted_idx]
          else:
              return self._constructor(values=self._codes[sorted_idx],
                                       dtype=self.dtype,
                                       fastpath=True)