def visit_end_of_graph(self):
    self._dump_raw('}\n')
    if (not self._dump_dot_only):
        import sys
        import tempfile

        def write_temp_file(suffix, data):
            (fd, filename) = tempfile.mkstemp(suffix=suffix)
            print(('Writing "%s"...' % filename))
            with os.fdopen(fd, 'w') as fp:
                fp.write(data)
            print('Done! Please remember to remove the file.')
            return filename
        try:
            import graphviz
        except ImportError:
            print('Python graphviz not found. Please invoke')
            print('  $ pip install graphviz')
            print('in order to enable automatic conversion to HTML.')
            print()
            print('You may also convert DOT to SVG manually via')
            print('  $ dot -Tsvg input.dot -o output.svg')
            print()
            write_temp_file('.dot', self.output())
            return
        svg = graphviz.pipe('dot', 'svg', self.output())
        filename = write_temp_file('.html', ('<html><body bgcolor="%s">%s</body></html>' % (('#1a1a1a' if self._dark_mode else 'white'), svg)))
        if (sys.platform == 'win32'):
            os.startfile(filename)
        elif (sys.platform == 'darwin'):
            os.system(('open "%s"' % filename))
        else:
            os.system(('xdg-open "%s"' % filename))
def visit_end_of_graph(self):
    self._dump_raw('}\n')
    if (not self._dump_dot_only):
        import sys
        import tempfile

        def write_temp_file(suffix, data):
            (fd, filename) = tempfile.mkstemp(suffix=suffix)
            print(('Writing "%s"...' % filename))
            with os.fdopen(fd, 'w') as fp:
                fp.write(data)
            print('Done! Please remember to remove the file.')
            return filename
        try:
            import graphviz
        except ImportError:
            print('Python graphviz not found. Please invoke')
            print('  $ pip install graphviz')
            print('in order to enable automatic conversion to HTML.')
            print()
            print('You may also convert DOT to SVG manually via')
            print('  $ dot -Tsvg input.dot -o output.svg')
            print()
            write_temp_file('.dot', self.output())
            return
        svg = graphviz.pipe('dot', 'svg', self.output())
        filename = write_temp_file('.html', ('<html><body bgcolor="%s">%s</body></html>' % (('#1a1a1a' if self._dark_mode else 'white'), svg)))
        if (sys.platform == 'win32'):
            os.startfile(filename)
        elif (sys.platform == 'darwin'):
            os.system(('open "%s"' % filename))
        else:
            os.system(('xdg-open "%s"' % filename))