@SuppressWarnings("unchecked")
    public T pushFilteredState(Function<String, String> filter) {
        CodeSection section = CodeSection.forName("__filtered_state_" + states.size() + 1);
        pushState(section);
        onSection(CodeInterceptor.forName(section.sectionName(), (w, content) -> {
            writeInlineWithNoFormatting(filter.apply(content));
        }));
        return (T) this;
    }
Pushes an anonymous named state that is always passed through the given
filter function before being written to the writer.

@param filter Function that maps over the entire section when popped.
@return Returns the code writer.
smithy-utils/src/main/java/software/amazon/smithy/utils/AbstractCodeWriter.java