code: def load_ipython_extension(ipython):
      reloader = JupyterReloader(ipython)
  
      @magic_arguments()
      @argument(
          "--demo-name",
          default="demo",
          help="Name of gradio blocks instance.",
      )
      @argument(
          "--share",
          default=False,
          const=True,
          nargs="?",
          help="Whether to launch with sharing. Will slow down reloading.",
      )
      @register_cell_magic
      @needs_local_scope
      def blocks(line, cell, local_ns):
          """Launch a demo defined in a cell in reload mode."""
  
          args = parse_argstring(blocks, line)
  
          exec(cell, None, local_ns)
          demo: gr.Blocks = local_ns[args.demo_name]
          if not reloader.demo_tracked():
              demo.launch(share=args.share)
              reloader.track(demo)
          elif reloader.queue_changed(demo):
              print("Queue got added or removed. Restarting demo.")
              reloader.running_demo.close()
              demo.launch()
              reloader.track(demo)
          else:
              reloader.swap_blocks(demo)
              return reloader.running_demo.artifact
  
file_path: gradio/gradio/ipython_ext.py
imports: import gradio
  from gradio.networking import App
  from gradio.utils import BaseReloader
label_desc: Use image node_id 1 for calling a global function with example usage: load_ipython_extension(ipython) and returns: reloader