'Add a date template to manage and use in search of dates.
Parameters
template : DateTemplate or str
Can be either a `DateTemplate` instance, or a string which will
be used as the pattern for the `DatePatternRegex` template. The
template will then be added to the detector.
Raises
ValueError
If a template already exists with the same name.'

def appendTemplate(self, template):

    if isinstance(template, str):
        key = pattern = template
        if ('%' not in pattern):
            key = pattern.upper()
        template = DD_patternCache.get(key)
        if (not template):
            if (key in ('{^LN-BEG}', '{DEFAULT}')):
                flt = (lambda template: ((template.flags & DateTemplate.LINE_BEGIN) if (key == '{^LN-BEG}') else None))
                self.addDefaultTemplate(flt)
                return
            elif ('{DATE}' in key):
                self.addDefaultTemplate((lambda template: (not (template.flags & DateTemplate.LINE_BEGIN))), pattern)
                return
            else:
                template = _getPatternTemplate(pattern, key)
        DD_patternCache.set(key, template)
    self._appendTemplate(template)
    logSys.info('        date    pattern    `%r`:    `%s`', getattr(template, 'pattern', ''), template.name)
    logSys.debug('        date    pattern    regex    for    %r:    %s', getattr(template, 'pattern', ''), template.regex)
