human
sorting list of tuples by arbitrary key
assistant
Here is some code to sort list `mylist` of tuples by arbitrary key from list `order`

sorted(mylist, key=lambda x: order.index(x[1]))

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.