private Method findContextMethod(CodeSection section, String key) {
        for (Method method : section.getClass().getMethods()) {
            if (method.getName().equals(key) || method.getName().equals("get" + StringUtils.capitalize(key))) {
                if (!method.getReturnType().equals(Void.TYPE)) {
                    return method;
                }
            }
        }
        return null;
    }
Gets a named contextual key-value pair from the current state or any parent states.

@param key Key to retrieve.
@return Returns the associated value or null if not present.
smithy-utils/src/main/java/software/amazon/smithy/utils/AbstractCodeWriter.java