Applies search written in DjangoQL mini-language to given queryset

def apply_search(queryset, search, schema=None):
    """
    Applies search written in DjangoQL mini-language to given queryset
    """
    ast = DjangoQLParser().parse(search)
    schema = schema or DjangoQLSchema
    schema_instance = schema(queryset.model)
    schema_instance.validate(ast)
    return queryset.filter(build_filter(ast, schema_instance))