code: def iteritems(self):
          
          sorted_data = sorted(self.data.iteritems(), self.cmp, self.key,
                               self.reverse)
          for k,v in sorted_data:
              yield k,v
docs: Sort and then iterate the dictionary