c = [('Pineapple', 1, 'Hawaii'), ('Orange', 3, 'Florida'), ('Banana', 1,
    'Hawaii'), ('Apple', 1, 'Washington'), ('Cherry', 2, 'Washington')]
d = sorted(c, key=getsortfunction(c, [(1, True), (2, False), (0, False)]))
e = sorted(c, key=getsortfunction(c, [(1, True), (0, False)]))
Sort at various levels in Python