Given an array of strings, how would you group anagrams?
Implement group_anagrams(strs) to return a list of groups. Each group must contain strings that are anagrams of one another, preserve the input order within the group, and preserve the order in which groups are first encountered. Assume strings contain lowercase English letters only. The input may be empty.
def group_anagrams(strs):