mylist1 = ['alpha', 'green']
mylist2 = ['blue', 'alpha', 'red']
sort_order = ['red', 'blue', 'green', 'alpha']
mylist1.sort(key=sort_order.index)
mylist1
mylist2.sort(key=sort_order.index)
mylist2
Custom sort order of list