def METHOD_NAME(q, limit=500, offset=0):
    q['limit'] = limit
    q['offset'] = offset
    while True:
        ret = query(q)
        if not ret:
            return
        yield from ret
        # We haven't got as many we have requested. No point making one more request
        if len(ret) < limit:
            break
        q['offset'] += limit