byrempcs = sorted(promotion_items, key=bypcs)

def bydra(k):
    return promotion_items[k]['discount_ratio']
bydiscra = sorted(promotion_items, key=bydra)
Sort by key of dictionary inside a dictionary in Python