x = dict(sorted(details.items(), key=lambda x: sum(x[1]))) # x = dict(sorted(details.items(), key=lambda x: x[1][-1])) # x = dict(sorted(details.items(), key=lambda x ...