<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_sort_function(order):
 """ Returns a callable similar to the built-in `cmp`, to be used on objects. Takes a list of dictionaries. In each, 'key' must be a string that is used to get an attribute of the objects to compare, and 'reverse' must be a boolean indicating whether the result should be reversed. """

    stable = tuple((d['key'], -1 if d['reverse'] else 1) for d in order)
    def sort_function(a, b):
        for name, direction in stable:
            v = cmp(getattr(a, name) if a else a, getattr(b, name) if b else b)
            if v != 0:
                return v * direction
        return 0
    return sort_function