def get_page(self, object_list):
        '''
        Return a paginated object list, along with some metadata

        If self.page_size is not None, pagination is enabled.

        The page_size can be overridden by passing it in the requst, but it is
        limited to 1 < page_size < max_page_size.

        max_page_size defaults to self.page_size.

        If a page_num is passed, it is fed to regular Django pagination
        If an offset is passed, page_num is derived from it by dividing it by
        page_size.

        '''
        page_size = getattr(self, 'page_size', None)
        if page_size is None:
            return {
                'meta': {},
                'objects': object_list,
            }
        max_page_size = getattr(self, 'max_page_size', page_size)

        try:
            page_size = int(self.request.GET.get(self.LIMIT_PARAM, page_size))
        except __HOLE__:
            raise http.NotFound('Invalid page size')
        page_size = max(1, min(page_size, max_page_size))

        page_num = 0
        try:
            page_num = int(self.request.GET[self.PAGE_PARAM])
        except ValueError:
            # Bad page - default to 0
            pass
        except KeyError:
            try:
                offset = int(self.request.GET[self.OFFSET_PARAM])
            except (ValueError, KeyError):
                pass
            else:
                page_num = offset // page_size

        paginator = Paginator(object_list, page_size, allow_empty_first_page=True)
        try:
            page = paginator.page(page_num + 1)
        except EmptyPage:
            raise http.NotFound()
        return {
            'meta': {
                'offset': page.start_index() - 1,
                'page': page_num,
                'total_pages': paginator.num_pages,
                'limit': page_size,
                'count': paginator.count,
                'has_next': page.has_next(),
                'has_prev': page.has_previous(),
            },
            'objects': page.object_list,
        }

    # Response helpers
dataset/ETHPy150Open funkybob/django-nap/nap/rest/publisher.py/Publisher.get_page