Sort and then iterate the dictionary

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