def lookup_template(settings, template):
    """Return a template name, which may have been overridden in the settings."""

    if 'TEMPLATE_OVERRIDES' in settings:
        val = settings['TEMPLATE_OVERRIDES']
        template = val.get(template, template)

    return template