Group anagrams

Write group_anagrams(words) that groups words that are anagrams of each other (same letters, any order) and returns the groups as a list of lists. Within a group keep the words in the order they appeared; order the groups by the first appearance of any of their words.

group_anagrams(["eat", "tea", "tan", "ate", "nat", "bat"])
    ->  [["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]
group_anagrams([])  ->  []

The point is to practise grouping by a computed key.

def group_anagrams(words):
    ...