code: def unsafe_execute(check_program, result, timeout):
      with create_tempdir():
          # These system calls are needed when cleaning up tempdir.
          import os
          import shutil
  
          rmtree = shutil.rmtree
          rmdir = os.rmdir
          chdir = os.chdir
  
          # Disable functionalities that can make destructive changes to the test.
          reliability_guard()
  
          # Run program.
          try:
              exec_globals = {}
              with swallow_io():
                  with time_limit(timeout):
                      exec(check_program, exec_globals)
              result.append("passed")
          except TimeoutException:
              result.append("timed out")
          except BaseException as e:
              result.append(f"failed: {e}")
  
          # Needed for cleaning up.
          shutil.rmtree = rmtree
          os.rmdir = rmdir
          os.chdir = chdir
  
imports: import contextlib
  import faulthandler
  import io
  import multiprocessing
  import os
  import platform
  import signal
  import tempfile
label_desc: Use image node_id 2 for calling a global function with example usage: unsafe_execute(check_program, result, timeout) without return types