def view_graph(graph_str, dest_file=None):
from rez.system import system<EOL>from rez.config import config<EOL>if (system.platform == "<STR_LIT>") and (not os.getenv("<STR_LIT>")):<EOL><INDENT>print("<STR_LIT>", file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>dest_file = _write_graph(graph_str, dest_file=dest_file)<EOL>viewed = False<EOL>prog = config.image_viewer or '<STR_LIT>'<EOL>print("<STR_LIT>" % prog)<EOL>if config.image_viewer:<EOL><INDENT>proc = popen([config.image_viewer, dest_file])<EOL>proc.wait()<EOL>viewed = not bool(proc.returncode)<EOL><DEDENT>if not viewed:<EOL><INDENT>import webbrowser<EOL>webbrowser.open_new("<STR_LIT>" + dest_file)<EOL><DEDENT>
View a dot graph in an image viewer.