def METHOD_NAME(view, groups_colors):
    """Colorize groups by type in given view"""
    override_empty = DB.OverrideGraphicSettings()
    for element in get_all_view_elements(view):
        element_override = override_empty
        if element.GroupId and element.GroupId != DB.ElementId.InvalidElementId:
            group_type_id = revit.doc.GetElement(element.GroupId).GetTypeId()
            if group_type_id and group_type_id in groups_colors.keys():
                element_override = groups_colors[group_type_id]
        view.SetElementOverrides(element.Id, element_override)