private static boolean canFilterShape(Model model, Shape shape) {
        return !shape.isMemberShape() || model.getShape(shape.asMemberShape().get().getContainer())
                .filter(container -> container.isStructureShape()
                        || container.isUnionShape()
                        || container.isEnumShape()
                        || container.isIntEnumShape())
                .isPresent();
    }
Filters shapes out of a model that do not match a predicate.

<p>Members of lists, sets, and maps are not passed to the filter
function or eligible for removal.

<p>If a shape is removed from the model that is a trait definition,
all instances of that trait are automatically removed.

@see ModelTransformer#filterShapes
smithy-model/src/main/java/software/amazon/smithy/model/transform/FilterShapes.java