def METHOD_NAME(
    self,
    name: str,
    skel: 'viur.core.skeleton.SkeletonInstance',
    dbFilter: db.Query,
    rawFilter: Dict
) -> Optional[db.Query]:
    if "orderby" in rawFilter and (rawFilter["orderby"] == name or (
        isinstance(rawFilter["orderby"], str) and rawFilter["orderby"].startswith(
        "%s." % name) and self.languages)):
        if self.languages:
            lang = None
            if rawFilter["orderby"].startswith("%s." % name):
                lng = rawFilter["orderby"].replace("%s." % name, "")
                if lng in self.languages:
                    lang = lng
            if lang is None:
                lang = current.language.get()  # currentSession.getLanguage()
                if not lang or not lang in self.languages:
                    lang = self.languages[0]
            if self.caseSensitive:
                prop = "%s.%s" % (name, lang)
            else:
                prop = "%s.%s.idx" % (name, lang)
        else:
            if self.caseSensitive:
                prop = name
            else:
                prop = name + ".idx"
        if "orderdir" in rawFilter and rawFilter["orderdir"] == "1":
            order = (prop, db.SortOrder.Descending)
        elif "orderdir" in rawFilter and rawFilter["orderdir"] == "2":
            order = (prop, db.SortOrder.InvertedAscending)
        elif "orderdir" in rawFilter and rawFilter["orderdir"] == "3":
            order = (prop, db.SortOrder.InvertedDescending)
        else:
            order = (prop, db.SortOrder.Ascending)
        inEqFilter = [x for x in dbFilter.queries.filters.keys() if  # FIXME: This will break on multi queries
                      (">" in x[-3:] or "<" in x[-3:] or "!=" in x[-4:])]
        if inEqFilter:
            inEqFilter = inEqFilter[0][: inEqFilter[0].find(" ")]
            if inEqFilter != order[0]:
                logging.warning("I fixed you query! Impossible ordering changed to %s, %s" % (inEqFilter, order[0]))
                dbFilter.order(inEqFilter, order)
            else:
                dbFilter.order(order)
        else:
            dbFilter.order(order)
    return dbFilter