code: def get_elwise_program(
      context: cl.Context,
      arguments: List[DtypedArgument],
      operation: str,
      *,
      name: str = "elwise_kernel",
      options: Any = None,
      preamble: str = "",
      loop_prep: str = "",
      after_loop: str = "",
      use_range: bool = False,
  ) -> cl.Program:
      if use_range:
          body = r"""//CL//
            if (step < 0)
            {
              for (i = start + (work_group_start + lid)*step;
                i > stop; i += gsize*step)
              {
                %(operation)s;
              }
            }
            else
            {
              for (i = start + (work_group_start + lid)*step;
                i < stop; i += gsize*step)
              {
                %(operation)s;
              }
            }
            """
      else:
          body = """//CL//
            for (i = work_group_start + lid; i < n; i += gsize)
            {
              %(operation)s;
            }
            """
  
      import re
  
      return_match = re.search(r"\breturn\b", operation)
      if return_match is not None:
          from warnings import warn
  
          warn(
              "Using a 'return' statement in an element-wise operation will "
              "likely lead to incorrect results. Use "
              "PYOPENCL_ELWISE_CONTINUE instead.",
              stacklevel=3,
          )
  
      source = f"""//CL//
          {preamble}
  
          #define PYOPENCL_ELWISE_CONTINUE continue
  
          __kernel void {name}({", ".join(arg.declarator() for arg in arguments)})
          {{
            int lid = get_local_id(0);
            int gsize = get_global_size(0);
            int work_group_start = get_local_size(0)*get_group_id(0);
            long i;
  
            {loop_prep};
            {body % {"operation": operation}}
            {after_loop};
          }}
          """
  
      return cl.Program(context, source).build(options)
  
imports: import enum
  from typing import Any, List, Optional, Tuple, Union
  import numpy
  import pyopencl
  from pyopencl.tools import context_dependent_memoize
  from pyopencl.tools import dtype_to_ctype, DtypedArgument, VectorArg, ScalarArg, KernelTemplateBase, dtype_to_c_struct
  from pytools import memoize_method
label_desc: Use image node_id 1 for calling a global function with example usage: get_elwise_program(context, arguments, operation) and returns: cl