code: def render_output_pygraphviz(self, dotdata, **kwargs):
          
          if not HAS_PYGRAPHVIZ:
              raise CommandError("You need to install pygraphviz python module")
  
          version = pygraphviz.__version__.rstrip("-svn")
          try:
              if tuple(int(v) for v in version.split('.')) < (0, 36):
                  # HACK around old/broken AGraph before version 0.36 (ubuntu ships with this old version)
                  tmpfile = tempfile.NamedTemporaryFile()
                  tmpfile.write(dotdata)
                  tmpfile.seek(0)
                  dotdata = tmpfile.name
          except ValueError:
              pass
  
          graph = pygraphviz.AGraph(dotdata)
          graph.layout(prog=kwargs['layout'])
          graph.draw(kwargs['outputfile'])
docs: Render model data as image using pygraphviz