def sort_against(list1, list2, reverse=False):
 try:
  return [item for (_, item) in sorted(zip(list2, list1), key=(lambda x: x[0]), reverse=reverse)]
 except:
  return list1

def sort_against ( list1 , list2 , reverse = False ) : try : return [ item for ( _ , item ) in sorted ( zip ( list2 , list1 ) , key = ( lambda x : x [ 0 ] ) , reverse = reverse ) ] except : return list1
arrange items of list1 in the same order as sorted .