code: def kill_python(p):
      """Run the given Popen process until completion and return stdout."""
      p.stdin.close()
      data = p.stdout.read()
      p.stdout.close()
      # try to cleanup the child so we don't appear to leak when running
      # with regrtest -R.
      p.wait()
      subprocess._cleanup()
      return data
  
imports: import collections
  import importlib
  import sys
  import os
  import os.path
  import subprocess
  import py_compile
  from importlib.util import source_from_cache
  from test import support
  from test.support.import_helper import make_legacy_pyc
label_desc: Use image node_id 7 for calling a global function with example usage: kill_python(p) and returns: data