Python anagrams, with tests