def parse_template(template):
    """returns a 2-tuple of (template_name, number_of_priors)"""
    m = TEMPLATE_OVERRIDE_RE.match(template)
    if not m:
        return template, 0
    return m.group('template'), int(m.group('depth'))