3 # sorted() was introduced in 2.4
4 if sys.version_info[:2] < (2, 4):
5 # Define our own version of sorted
6 def sorted(iterable, cmp=cmp, key=lambda x: x, reverse = False):
7 # Make a list out of the iterable
9 # Sort the list, using the given comparator and key function
10 lst.sort(lambda x, y: cmp(key(x), key(y)))
11 # Reverse if requested