function newItem(itemIn) {
        // include name and templateitemname in the output object for ALL
        // container array items. Note: you could potentially use different
        // name and templateitemname, if you're using one template to make
        // another template. templateitemname would be the name in the original
        // template, and name is the new "subclassed" item name.
        var out = {name: itemIn.name, _input: itemIn};
        var templateItemName = out[TEMPLATEITEMNAME] = itemIn[TEMPLATEITEMNAME];

        // no itemname: use the default template
        if(!validItemName(templateItemName)) {
            out._template = defaultsTemplate;
            return out;
        }

        // look for an item matching this itemname
        // note these do not inherit from the default template, only the item.
        for(var i = 0; i < templateItems.length; i++) {
            var templateItem = templateItems[i];
            if(templateItem.name === templateItemName) {
                // Note: it's OK to use a template item more than once
                // but using it at least once will stop it from generating
                // a default item at the end.
                usedNames[templateItemName] = 1;
                out._template = templateItem;
                return out;
            }
        }

        // Didn't find a matching template item, so since this item is intended
        // to only be modifications it's most likely broken. Hide it unless
        // it's explicitly marked visible - in which case it gets NO template,
        // not even the default.
        out[inclusionAttr] = itemIn[inclusionAttr] || false;
        // special falsy value we can look for in validateTemplate
        out._template = false;
        return out;
    }
arrayTemplater: special logic for templating both defaults and specific items
in a container array (annotations etc)

@param {object} container: the outer container, should already have _template
    if there *is* a template for this plot
@param {string} name: the name of the array to template (ie 'annotations')
    will be used to find default ('annotationdefaults' object) and specific
    ('annotations' array) template specs.
@param {string} inclusionAttr: the attribute determining this item's
    inclusion in the output, usually 'visible' or 'enabled'

@returns {object}: {newItem, defaultItems}, both functions:
    newItem(itemIn): create an output item, bare except for the correct
        template and name(s), as the base for supplyDefaults
    defaultItems(): to be called after all newItem calls, return any
        specific template items that have not already beeen included,
        also as bare output items ready for supplyDefaults.