1👍
✅
Extract the priority and keys and then sort based on priority i.e.
sorted_dict.keyOrder = [key[1] for key in sorted((v['priority'],k) for k,v in sorted_dict.items())]
Source:stackexchange.com