code: def run_script_with_args(
      binary: str, script_path: str, *args: Any, **kwargs: Any
  ):
      """Run script using a binary and command line arguments.
  
      Args:
          binary: str, the binary to run the script with, e.g. 'python'.
          script_path: str, the path to the script.
          *args: Any, a collection of arguments which will be converted to string
              and passed on to the run command.
          **kwargs: Any, keyword arguments which will be converted to named script
              arguments.
  
      Returns:
          The contents of the results, which the script is assumed to store,
          given an output file path as an argument.
  
      Raises:
          FileNotFoundError if the script cannot be found.
  
      Notes:
          It assumes that the script will store the results on disk using the
          path provided by the last of the command line arguments.
      """
      if not os.path.isfile(script_path):
          raise FileNotFoundError(f"Cannot find script {script_path}.")
      with tempfile.TemporaryDirectory() as tmpdir:
          output_file = os.path.join(tmpdir, "results.pkl")
          args_as_str, kwargs_as_str = [], []
          if args:
              args_as_str.extend([*map(str, args), output_file])
          if kwargs:
              kwargs_as_str.extend(
                  [str(item) for k_v in kwargs.items() for item in k_v]
              )
              kwargs_as_str.extend(["--output_file", output_file])
          run_command(
              [binary, script_path, *args_as_str, *kwargs_as_str]
          )
          return fetch_result(output_file)
  
imports: import enum
  import importlib
  import os
  import pickle
  import re
  import subprocess
  import sys
  import tempfile
  import time
  from dataclasses import dataclass, field
  from functools import partial
  from typing import Any, Callable, Dict, List, Tuple, Union
label_desc: Use image node_id 6 for calling a global function with example usage: run_script_with_args(binary, script_path) and returns: fetch_result