code: def _strip_prompts(prompt_re, initial_re=None, turnoff_re=None):
      """Remove matching input prompts from a block of input.
  
      Parameters
      ----------
      prompt_re : regular expression
          A regular expression matching any input prompt (including continuation)
      initial_re : regular expression, optional
          A regular expression matching only the initial prompt, but not continuation.
          If no initial expression is given, prompt_re will be used everywhere.
          Used mainly for plain Python prompts, where the continuation prompt
          ``...`` is a valid Python expression in Python 3, so shouldn't be stripped.
  
      If initial_re and prompt_re differ,
      only initial_re will be tested against the first line.
      If any prompt is found on the first two lines,
      prompts will be stripped from the rest of the block.
      """
      if initial_re is None:
          initial_re = prompt_re
      line = ""
      while True:
          line = yield line
  
          # First line of cell
          if line is None:
              continue
          out, n1 = initial_re.subn("", line, count=1)
          if turnoff_re and not n1:
              if turnoff_re.match(line):
                  # We're in e.g. a cell magic; disable this transformer for
                  # the rest of the cell.
                  while line is not None:
                      line = yield line
                  continue
  
          line = yield out
  
          if line is None:
              continue
          # check for any prompt on the second line of the cell,
          # because people often copy from just after the first prompt,
          # so we might not see it in the first line.
          out, n2 = prompt_re.subn("", line, count=1)
          line = yield out
  
          if n1 or n2:
              # Found a prompt in the first two lines - check for it in
              # the rest of the cell as well.
              while line is not None:
                  line = yield prompt_re.sub("", line, count=1)
  
          else:
              # Prompts not in input - wait for reset
              while line is not None:
                  line = yield line
  
imports: import abc
  import functools
  import re
  from IPython.core.splitinput import LineInfo
  from IPython.utils import tokenize2
  from IPython.utils.openpy import cookie_comment_re
  from IPython.utils.py3compat import with_metaclass, PY3
  from IPython.utils.tokenize2 import generate_tokens, untokenize, TokenError
label_desc: Use image node_id 16 for calling a global function with example usage: _strip_prompts(prompt_re, initial_re, turnoff_re) without return types