def api_bills(*, page='1'): page_index = get_page_index(page) num = yield from Bills.findNumber('count(id)') p = Page(num, page_index) if num == 0: return dict(page=p, bills=()) bills = yield from Bills.findAll(limit=(p.offset, p.limit)) return dict(page=p, bills=bills)