def dset_to_html(dset, tmpl_fpath):
def stamp_to_datetime(stamp):<EOL><INDENT>"""<STR_LIT>"""<EOL>return datetime.datetime.fromtimestamp(int(stamp))<EOL><DEDENT>def strftime(dtime, fmt):<EOL><INDENT>"""<STR_LIT>"""<EOL>return dtime.strftime(fmt)<EOL><DEDENT>def ansi_to_html(ansi):<EOL><INDENT>"""<STR_LIT>"""<EOL>conv = ansi2html.Ansi2HTMLConverter(<EOL>scheme="<STR_LIT>",<EOL>inline=True<EOL>)<EOL>html = conv.convert(ansi, full=False)<EOL>with open("<STR_LIT>", "<STR_LIT:w>") as html_file:<EOL><INDENT>html_file.write(html)<EOL><DEDENT>return html<EOL><DEDENT>tmpl_dpath = os.path.dirname(tmpl_fpath)<EOL>tmpl_fname = os.path.basename(tmpl_fpath)<EOL>env = jinja2.Environment(<EOL>autoescape=True,<EOL>loader=jinja2.FileSystemLoader(tmpl_dpath)<EOL>)<EOL>env.filters['<STR_LIT>'] = stamp_to_datetime<EOL>env.filters['<STR_LIT>'] = strftime<EOL>env.filters['<STR_LIT>'] = ansi_to_html<EOL>tmpl = env.get_template(tmpl_fname)<EOL>return tmpl.render(dset=dset)<EOL>
@returns A HTML representation of the given 'dset' using the template at
'tmpl_fpath'