'@return a sequence of (key, value,) pairs sorted according to value'

def items_sorted_by_value(self):

    l = [(x[1], x[0]) for x in self.d.iteritems()]
    l.sort()
    return [(x[1], x[0]) for x in l]
