def visualize(mxgraph, theme='dark', path_html='visualization_output.html', title='MX viz', save_file=True):
    module_root = './'
    env = Environment(loader=FileSystemLoader(module_root))
    d3_save_svg_path = './d3-save-svg-gh-pages/assets/d3-save-svg.min.js'
    with open(d3_save_svg_path, 'r') as f:
        d3_save_svg = f.readlines()
    if (theme == 'dark'):
        js_path = './javascript/mx_viz.js'
        with open(js_path, 'r') as f:
            js_text = f.read()
        css_path = './style/style.css'
        with open(css_path, 'r') as f:
            css_text = f.read()
        template = env.get_template('./templates/mx_viz.html').render(title=title, js_text=js_text, css_text=css_text, mxgraph=mxgraph, d3_save_svg=d3_save_svg[0])
    elif (theme == 'light'):
        js_path = './javascript/mx_vizlighttheme.js'
        with open(js_path, 'r') as f:
            js_text = f.read()
        css_path = './style/style_lighttheme.css'
        with open(css_path, 'r') as f:
            css_text = f.read()
        template = env.get_template('./templates/mx_viz_lighttheme.html').render(title=title, js_text=js_text, css_text=css_text, mxgraph=mxgraph, d3_save_svg=d3_save_svg[0])
    if save_file:
        with open(path_html, 'wb') as outfile:
            print(('Wrote visualization to: %s' % path_html))
            outfile.write(template.encode('utf-8'))
    return template
def visualize(mxgraph, theme='dark', path_html='visualization_output.html', title='MX viz', save_file=True):
    module_root = './'
    env = Environment(loader=FileSystemLoader(module_root))
    d3_save_svg_path = './d3-save-svg-gh-pages/assets/d3-save-svg.min.js'
    with open(d3_save_svg_path, 'r') as f:
        d3_save_svg = f.readlines()
    if (theme == 'dark'):
        js_path = './javascript/mx_viz.js'
        with open(js_path, 'r') as f:
            js_text = f.read()
        css_path = './style/style.css'
        with open(css_path, 'r') as f:
            css_text = f.read()
        template = env.get_template('./templates/mx_viz.html').render(title=title, js_text=js_text, css_text=css_text, mxgraph=mxgraph, d3_save_svg=d3_save_svg[0])
    elif (theme == 'light'):
        js_path = './javascript/mx_vizlighttheme.js'
        with open(js_path, 'r') as f:
            js_text = f.read()
        css_path = './style/style_lighttheme.css'
        with open(css_path, 'r') as f:
            css_text = f.read()
        template = env.get_template('./templates/mx_viz_lighttheme.html').render(title=title, js_text=js_text, css_text=css_text, mxgraph=mxgraph, d3_save_svg=d3_save_svg[0])
    if save_file:
        with open(path_html, 'wb') as outfile:
            print(('Wrote visualization to: %s' % path_html))
            outfile.write(template.encode('utf-8'))
    return template