def _paginate_query(model, limit=None, marker=None, sort_key=None, sort_dir=None, query=None):
    if (not query):
        query = model_query(model)
    if (not sort_key):
        sort_keys = []
    elif (not isinstance(sort_key, list)):
        sort_keys = [sort_key]
    else:
        sort_keys = sort_key
    if ('id' not in sort_keys):
        sort_keys.append('id')
    query = db_utils.paginate_query(query, model, limit, sort_keys, marker=marker, sort_dir=sort_dir)
    return query.all()
def _paginate_query(model, limit=None, marker=None, sort_key=None, sort_dir=None, query=None):
    if (not query):
        query = model_query(model)
    if (not sort_key):
        sort_keys = []
    elif (not isinstance(sort_key, list)):
        sort_keys = [sort_key]
    else:
        sort_keys = sort_key
    if ('id' not in sort_keys):
        sort_keys.append('id')
    query = db_utils.paginate_query(query, model, limit, sort_keys, marker=marker, sort_dir=sort_dir)
    return query.all()