code: def _prepare_sort_options(self, has_pk):
          sort_options = {}
          if self._sort is not None and not has_pk:
              sort_options.update(self._sort)
          if self._sort_limits is not None:
              if 'start' in self._sort_limits and 'num' not in self._sort_limits:
                  self._sort_limits['num'] = -1
              elif 'num' in self._sort_limits and 'start' not in self._sort_limits:
                  self._sort_limits['start'] = 0
              sort_options.update(self._sort_limits)
          if not sort_options and self._sort is None:
              sort_options = None
          return sort_options