code: def multipleOrderComparison(cls, orders):
      '''Returns a function that will compare two items according to `orders`'''
      comparers = [ (o.keyfn, 1 if o.isAscending() else -1) for o in orders]
  
      def cmpfn(a, b):
        for keyfn, ascOrDesc in comparers:
          comparison = cmp(keyfn(a), keyfn(b)) * ascOrDesc
          if comparison is not 0:
            return comparison
        return 0
  
      return cmpff multipleOrderComparison(cls, orders):
      '''Returns a function that will compare two items according to `orders`'''
      comparers = [ (o.keyfn, 1 if o.isAscending() else -1) for o in orders]
  
      def cmpfn(a, b):
        for keyfn, ascOrDesc in comparers:
          comparison = cmp(keyfn(a), keyfn(b)) * ascOrDesc
          if comparison is not 0:
            return comparison
        return 0
  
      return cmpfn
docs: Returns a function that will compare two items according to `orders`