code: def get_roles_by_type(resource_root, service_name, role_type,
                        cluster_name="default", view=None):
    
    roles = get_all_roles(resource_root, service_name, cluster_name, view)
    return [ r for r in roles if r.type == role_type ]
docs: Get all roles of a certain type in a service
    @param resource_root: The root Resource object.
    @param service_name: Service name
    @param role_type: Role type
    @param cluster_name: Cluster name
    @return: A list of ApiRole objects.