yuri added a solution for sort_last with tuples