'Return a bytestring representing a templated file based on the
input (content) and the variable names defined (vars).  ``filename``
is used for exception reporting.'

def render_template(self, content, vars, filename=None):

    content = native_(content, fsenc)
    try:
        return bytes_(substitute_escaped_double_braces(substitute_double_braces(content, TypeMapper(vars))), fsenc)
    except Exception as e:
        _add_except(e, ('    in    file    %s' % filename))
        raise
