code: def _get_graph(graph, filename):
      
      try:
          rendered = graph.rendered_file
      except AttributeError:
          try:
              graph.render(os.path.join(server.tmpdir, filename), format='png')
              rendered = filename
          except OSError:
              rendered = None
      graph.rendered_file = rendered
      return rendered
docs: Retrieve or render a graph.