code: def _extract_extra_args_types_values(extra_args):
      if extra_args is None:
          extra_args = []
      from pyopencl.tools import VectorArg, ScalarArg
  
      extra_args_types = []
      extra_args_values = []
      extra_wait_for = []
      for name, val in extra_args:
          if isinstance(val, cl.array.Array):
              extra_args_types.append(
                  VectorArg(val.dtype, name, with_offset=False)
              )
              extra_args_values.append(val)
              extra_wait_for.extend(val.events)
          elif isinstance(val, np.generic):
              extra_args_types.append(ScalarArg(val.dtype, name))
              extra_args_values.append(val)
          else:
              raise RuntimeError("argument '%d' not understood" % name)
  
      return tuple(extra_args_types), extra_args_values, extra_wait_for
  
imports: from dataclasses import dataclass
  from typing import Optional
  import numpy
  import pyopencl
  import pyopencl.array
  from pyopencl.elementwise import ElementwiseKernel
  from pyopencl.scan import ScanTemplate, GenericScanKernel
  from pyopencl.tools import dtype_to_ctype, get_arg_offset_adjuster_code
  from pytools import memoize, memoize_method
  from mako.template import Template
label_desc: Use image node_id 1 for calling a global function with example usage: _extract_extra_args_types_values(extra_args) and returns: tuple,  extra_args_values,  extra_wait_for