code: def _assert_python(expected_success, /, *args, **env_vars):
      res, cmd_line = run_python_until_end(*args, **env_vars)
      if (res.rc and expected_success) or (
          not res.rc and not expected_success
      ):
          res.fail(cmd_line)
      return res
  
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 3 for calling a global function with example usage: _assert_python() and returns: res