If I understood the code below correctly, the function is supposed to be a key getter, not an actual sorting function, so calling it a sorting function is confusing.