def _page(q, chunk=1000):
    """ Quick utility to page a query, 1000 items at a time.
    We need this so we don't OOM (out of memory) ourselves loading the world.
    """
    offset = 0
    while True:
        r = False
        for elem in q.limit(chunk).offset(offset):
            r = True
            yield elem
        offset += chunk
        if not r:
            break
