Use of key in the sorted function