don't need to use list() on arguments of zip.
sorted() acts on an iterable and returns a list, so there is no need to cast its argument to list or to cast its return to list
instead of reversed(sorted((d).keys())), do sorted(d, reverse=True) -- simpler, more succint, and more efficient