code: def output_args(f):
      """decorator for output-formatting args
  
      applied to %pxresult and %%px
      """
      args = [
          magic_arguments.argument(
              "-r",
              action="store_const",
              dest="groupby",
              const="order",
              help="collate outputs in order (same as group-outputs=order)",
          ),
          magic_arguments.argument(
              "-e",
              action="store_const",
              dest="groupby",
              const="engine",
              help="group outputs by engine (same as group-outputs=engine)",
          ),
          magic_arguments.argument(
              "--group-outputs",
              dest="groupby",
              type=str,
              choices=["engine", "order", "type"],
              default="type",
              help="""Group the outputs in a particular way.
  
              Choices are:
  
              **type**: group outputs of all engines by type (stdout, stderr, displaypub, etc.).
              **engine**: display all output for each engine together.
              **order**: like type, but individual displaypub output from each engine is collated.
                For example, if multiple plots are generated by each engine, the first
                figure of each engine will be displayed, then the second of each, etc.
              """,
          ),
          magic_arguments.argument(
              "-o",
              "--out",
              dest="save_name",
              type=str,
              help="""store the AsyncResult object for this computation
                   in the global namespace under this name.
              """,
          ),
      ]
      for a in args:
          f = a(f)
      return f
  
imports: import time
  from contextlib import contextmanager
  import inspect
  import re
  import sys
  from textwrap import dedent
  from IPython.core import magic_arguments
  from IPython.core.error import UsageError
  from IPython.core.magic import Magics, no_var_expand
  import ipyparallel
  from ..None import error
label_desc: Use image node_id 5 for calling a global function with example usage: output_args(f) and returns: f