def display_as_html(filename, html_outputfile=None):
    """opens the file as html in the web browser"""
    import nbconvert
    import webbrowser
    output = nbconvert.exporters.export(nbconvert.HTMLExporter(), filename)[0]
    if html_outputfile is None:
        import tempfile
        temp = tempfile.NamedTemporaryFile(mode='w+t', suffix='.html',
            delete=False)
        temp.write(output)
        temp.seek(0)
        webbrowser.open(temp.name)
    else:
        with open(html_outputfile, 'w+') as f:
            f.write(output)
        webbrowser.open(html_outputfile)
