Flask-Security: How to get / list / print all roles for a given user

def get_users():
    """Return list of all users"""
    attrs = (
    query = current_app.sywuserdb.user_model.query
    users = query.all()

    # convert to a list of dict of interesting info
    rv = []
    for user in users:
        # copy simple attributes
        userdata = {}
        for attr in attrs:
            userdata[attr] = getattr(user, attr)
        userdata["roles"] = [r.name for r in user.roles]

    # users is a list of tuples - convert to list of dict
    return {"status": 200, "msgs": [], "data": rv}
@api.route("/users", methods=["GET"])
@auth_required("token", "session")
def get_users():
    rv = get_users()
    return flask.jsonify(rv), rv["status"]