code: def split_stdin_stdout(text):
      """stdin is all text after the prompt up to and including
      the next newline.  Everything else is stdout.  stdout
      may contain regular expressions enclosed in {{}}."""
      prompt = re.escape("(gdb) \n")
      pattern = re.compile("(?<=%s)((?:\d*-.*)\n)" % prompt)
      stdin = "".join(re.findall(pattern, text))
      stdout = re.sub(pattern, "", text)
      outside_pattern = re.compile(
          r"(?:\A|(?<=\}\}))(?:[^\{]|(?:\{(?!\{)))*(?:(?=\{\{)|\Z)"
      )
  
      def escape_line(line):
          line = re.sub(
              outside_pattern, lambda m: re.escape(m.group(0)), line
          )
          return re.sub(r"\{\{|\}\}", "", line)
  
      stdout = "\n".join(
          [escape_line(line) for line in stdout.split("\n")]
      )
      return (stdin, stdout)
  
file_path: turicreate/src/external/boost/boost_1_68_0/tools/build/test/debugger-mi.py
imports: import BoostBuild
  import TestCmd
  import re
label_desc: Use image node_id 1 for calling a global function with example usage: split_stdin_stdout(text) and returns: stdin,  stdout, re