@allow_remote_invocation
    def get_pagination_data(self, in_data):
        try:
            limit = int(in_data['limit'])
            page = int(in_data['page'])
        except (TypeError, KeyError, ValueError):
            return {
                'success': False,
                'error': _("Please provide pagination info."),
            }

        start = (page - 1) * limit
        stop = limit * page

        rules = AutomaticUpdateRule.objects.filter(
            domain=self.domain,
            deleted=False
        ).order_by('name')[start:stop]

        total = AutomaticUpdateRule.objects.filter(
            domain=self.domain,
            deleted=False
        ).count()

        return {
            'response': {
                'itemList': map(self._format_rule, rules),
                'total': total,
                'page': page,
            },
            'success': True,
        }
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/data_interfaces/views.py/AutomaticUpdateRuleListView.get_pagination_data/original