def to_picture(self, filename):
fileformat = path.splitext(filename)[<NUM_LIT:1>][<NUM_LIT:1>:]<EOL>with NamedTemporaryFile("<STR_LIT:wb>", delete=False) as dotfile:<EOL><INDENT>dotfilename = dotfile.name<EOL>for line in self:<EOL><INDENT>dotfile.write(("<STR_LIT>" % line).encode("<STR_LIT:utf-8>"))<EOL><DEDENT>dotfile.flush()<EOL>cmd = ["<STR_LIT>", dotfilename, "<STR_LIT>", fileformat, "<STR_LIT>", filename]<EOL>check_call(cmd)<EOL><DEDENT>try:<EOL><INDENT>remove(dotfilename)<EOL><DEDENT>except Exception:  <EOL><INDENT>msg = '<STR_LIT>' % dotfilename<EOL>logging.getLogger(__name__).warn(msg)<EOL><DEDENT>
Write graph to a temporary file and invoke `dot`.

The output file type is automatically detected from the file suffix.

*`graphviz` needs to be installed, before usage of this method.*