I'd probably use `group_package_clause_by_filter`.