code: def cellmagic(end_on_blank_line: bool = False):
      """Captures & transforms cell magics.
  
      After a cell magic is started, this stores up any lines it gets until it is
      reset (sent None).
      """
      tpl = "get_ipython().run_cell_magic(%r, %r, %r)"
      cellmagic_help_re = re.compile(r"%%\w+\?")
      line = ""
      while True:
          line = yield line
          # consume leading empty lines
          while not line:
              line = yield line
  
          if not line.startswith(ESC_MAGIC2):
              # This isn't a cell magic, idle waiting for reset then start over
              while line is not None:
                  line = yield line
              continue
  
          if cellmagic_help_re.match(line):
              # This case will be handled by help_end
              continue
  
          first = line
          body = []
          line = yield None
          while (line is not None) and (
              (line.strip() != "") or not end_on_blank_line
          ):
              body.append(line)
              line = yield None
  
          # Output
          magic_name, _, first = first.partition(" ")
          magic_name = magic_name.lstrip(ESC_MAGIC2)
          line = tpl % (magic_name, first, "\n".join(body))
  
imports: import abc
  import functools
  import re
  import tokenize
  from tokenize import untokenize, TokenError
  from io import StringIO
  from IPython.core.splitinput import LineInfo
  from IPython.utils import tokenutil
label_desc: Use image node_id 15 for calling a global function with example usage: cellmagic(end_on_blank_line) without return types