add get all groups

Something like this, perhaps:
```python
def paginate(items, cursor, max_items):
    items = sorted(items)
    if cursor is not None:
        items = list(itertools.dropwhile(lambda item: item <= cursor, items))
    new_cursor = None
    if len(items) > max_items:
        items = items[:max_items]
        new_cursor = items[-1]
    return (items, new_cursor)
```