'Renders the HTML file using the configured template. Separated as a
method to be able to easily test.
:param context: A dict containing target urls, enabled plugins, etc.
:return: True on successful rendering'

def _render_html_file(self, template_fh, context, output_fh):

    severity_icon = functools.partial(get_severity_icon, self.template_root)
    env_config = {'undefined': StrictUndefined, 'trim_blocks': True, 'autoescape': True, 'lstrip_blocks': True}
    try:
        jinja2_env = Environment(**env_config)
    except TypeError:
        env_config.pop('lstrip_blocks')
        jinja2_env = Environment(**env_config)
    jinja2_env.filters['render_markdown'] = render_markdown
    jinja2_env.filters['request'] = request_dump
    jinja2_env.filters['response'] = response_dump
    jinja2_env.filters['severity_icon'] = severity_icon
    jinja2_env.filters['severity_text'] = get_severity_text
    jinja2_env.globals['get_current_date'] = get_current_date
    jinja2_env.loader = FileSystemLoader(self.template_root)
    template = jinja2_env.from_string(template_fh.read())
    try:
        rendered_output = template.render(context)
    except Exception as e:
        msg = u'Failed    to    render    html    report    template.    Exception:    "%s"'
        om.out.error((msg % e))
        return False
    try:
        output_fh.write(rendered_output.encode('utf-8'))
    except Exception as e:
        msg = u'Failed    to    write    html    report    to    output    file.    Exception:    "%s"'
        om.out.error((msg % e))
        return False
    return True
