python/anagram: Implement new spec