docs: def Group(items, key):
    """Groups items by given key function.
  
    Args:
      items: An iterable or an iterator of items.
      key: A function which given each item will return the key.
  
    Returns:
      A dict with keys being each unique key and values being a list of items of
      that key.
    """
    result = {}
  
    for item in items:
      result.setdefault(key(item), []).append(item)
  
    return result