code: def dag():
      if app.extensions["dag"] is None:
  
          def record(msg):
              if msg["level"] == "d3dag":
                  app.extensions["dag"] = msg
              elif msg["level"] in ("error", "info"):
                  app.extensions["log"].append(msg)
  
          run_snakemake(printd3dag=True, log_handler=[record])
      return json.dumps(app.extensions["dag"])
  
file_path: snakemake/snakemake/gui.py
imports: import json
  import os
  import threading
  from flask import Flask, render_template, request
  from snakemake.common import __version__
label_desc: Use image node_id 4 for calling a global function with example usage: dag() and returns: json