private static boolean isConditionTruthy(Object value) {
        if (value == null) {
            return false;
        } else if (value instanceof Optional) {
            return ((Optional<?>) value).isPresent();
        } else if (value instanceof Boolean) {
            return (Boolean) value;
        } else if (value instanceof Iterable) {
            return ((Iterable<?>) value).iterator().hasNext();
        } else if (value instanceof Map) {
            return !((Map<?, ?>) value).isEmpty();
        } else if (value instanceof String) {
            return !((String) value).isEmpty();
        } else {
            return true;
        }
    }
A BlockOperation that repeats a template for each value referenced by the block. Each iteration pushes
a state to the writer that includes key, value, key.first, and key.last context properties. The name
of the context property can be customized in the template.
smithy-utils/src/main/java/software/amazon/smithy/utils/CodeFormatter.java