def METHOD_NAME(collection, filters, regex, ignorecase, replace=True):
    result_filters = dict()
    queryset = collection.objects
    if "order_by" in filters:
        queryset = queryset.order_by(filters.pop("order_by"))
    for key, value in filters.items():
        key = key.replace(".", "__")
        if replace:
            if key in SEARCH_REPLACE:
                key = SEARCH_REPLACE[key]
        if regex and isinstance(value, str):
            flags = 0
            if ignorecase:
                flags |= re.I
            value = re.compile(value, flags=flags)
        if isinstance(value, list) and not key.endswith("__in"):
            key += "__all"
        result_filters[key] = value
    q = Q()
    for alias in collection.SEARCH_ALIASES:
        if alias in filters:
            q &= Q(**{collection.SEARCH_ALIASES[alias]: result_filters[alias]}) | Q(
                **{alias: result_filters[alias]}
            )
            result_filters.pop(alias)
    print("Filter: {}".format(result_filters), q.to_query(collection))
    return queryset.filter(**result_filters).filter(q)