def generate_list_resolver(schema_type, resolver_name):
    """
    Generate resolver for a list of schema_type.

    If a filterset_class is associated with the schema_type,
    the resolver will pass all arguments received to the FilterSet
    If not, it will return a restricted queryset for all objects

    Args:
        schema_type (DjangoObjectType): DjangoObjectType for a given model
        resolver_name (str): name of the resolver

    Returns:
        callable: Resolver function for list of element
    """
    model = schema_type._meta.model

    def list_resolver(self, info, **kwargs):
        if schema_type._meta.filterset_class:
            fsargs = {key: [value] for key, value in kwargs.items()}
            return schema_type._meta.filterset_class(
                fsargs, model.objects.restrict(info.context.user, "view").all()
            ).qs.all()

        return model.objects.restrict(info.context.user, "view").all()

    list_resolver.__name__ = resolver_name
    return list_resolver