def multikeysort(items, columns):
    comparers = [
        ((operator.itemgetter(col[1:].strip()), -1) if col.startswith('-') else (operator.itemgetter(col.strip()), 1)) for col in columns
    ]

    def comparer(left, right):
        for fn, mult in comparers:
            try:
                result = cmp_compat(fn(left), fn(right))
            except __HOLE__:
                return 0
            if result:
                return mult * result
        else:
            return 0
    try:
        # noinspection PyArgumentList
        return sorted(items, cmp=comparer)
    except TypeError:
        # Python 3 removed the cmp parameter
        import functools
        return sorted(items, key=functools.cmp_to_key(comparer))
dataset/ETHPy150Open dwighthubbard/hostlists/hostlists/hostlists.py/multikeysort