code: def script_args(f):
      """single decorator for adding script args"""
      args = [
          magic_arguments.argument(
              "--out",
              type=str,
              help="""The variable in which to store stdout from the script.
              If the script is backgrounded, this will be the stdout *pipe*,
              instead of the stderr text itself.
              """,
          ),
          magic_arguments.argument(
              "--err",
              type=str,
              help="""The variable in which to store stderr from the script.
              If the script is backgrounded, this will be the stderr *pipe*,
              instead of the stderr text itself.
              """,
          ),
          magic_arguments.argument(
              "--bg",
              action="store_true",
              help="""Whether to run the script in the background.
              If given, the only way to see the output of the command is
              with --out/err.
              """,
          ),
          magic_arguments.argument(
              "--proc",
              type=str,
              help="""The variable in which to store Popen instance.
              This is used only when --bg option is given.
              """,
          ),
      ]
      for arg in args:
          f = arg(f)
      return f
  
imports: from __future__ import print_function
  import errno
  import os
  import sys
  import signal
  import time
  from subprocess import Popen, PIPE
  import atexit
  from IPython.core import magic_arguments
  from IPython.core.magic import Magics, magics_class, line_magic, cell_magic
  from IPython.lib.backgroundjobs import BackgroundJobManager
  from IPython.utils import py3compat
  from IPython.utils.process import arg_split
  from traitlets import List, Dict, default
label_desc: Use image node_id 1 for calling a global function with example usage: script_args(f) and returns: f