def __convert_ordering(self, ordering, mapping):
        """Converts order_by '-'-prefix-able sorters according to a mapping."""
        if isinstance(ordering, basestring):
            ordering = [ordering]
        new_ordering = []
        for orderer in ordering:
            # get filter name stripping '-' if exists
            inverted = orderer.startswith('-')
            name = orderer[1:] if inverted else orderer
            # get new name if required
            if name in mapping:
                orderer = mapping[name]
                orderer = '-' + orderer if inverted else orderer
            new_ordering.append(orderer)
        return new_ordering
dataset/ETHPy150Open ipeirotis/Mturk-Tracker/app/mturk/search/crud_extensions.py/SearchResource.__convert_ordering/original