def METHOD_NAME(views):
    """Collect group elements in given view
    Returns:
        dict[DB.ElementId, DB.ElementId]: dict of group {type_id: element_id}
    """
    groups_dict = defaultdict(set)
    for view in views:
        groups = get_groups(view)
        for g in groups:
            groups_dict[g.GetTypeId()].add(g.Id)
    return groups_dict