private static Model includeExcludeShapeTags(
            ModelTransformer transformer,
            Model model,
            Set<String> tags,
            boolean exclude
    ) {
        return transformer.mapShapes(model,
                shape -> intersectIfChanged(shape.getTags(), tags, exclude)
                        .map(intersection -> {
                            TagsTrait.Builder builder = TagsTrait.builder();
                            intersection.forEach(builder::addValue);
                            return Shape.shapeToBuilder(shape).addTrait(builder.build()).build();
                        })
                        .orElse(shape));
    }
Utilities for {@link ExcludeTags} and {@link IncludeTags}.
smithy-build/src/main/java/software/amazon/smithy/build/transforms/TagUtils.java