As it is stated in the docs:
Quote:The value of the key parameter should be a function that takes a single argument and returns a key to use for sorting purposes.note the bold text - it should be single argument function
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs