code: def _row_kernel_string_from_template(frame, row_type, args):
      """
      Function to write numba kernels for `DataFrame.apply` as a string.
      Workaround until numba supports functions that use `*args`
  
      `DataFrame.apply` expects functions of a dict like row as well as
      possibly one or more scalar arguments
  
      def f(row, c, k):
          return (row['x'] + c) / k
  
      Both the number of input columns as well as their nullability and any
      scalar arguments may vary, so the kernels vary significantly. See
      templates.py for the full row kernel template and more details.
      """
      # Create argument list for kernel
      frame = _supported_cols_from_frame(frame)
  
      input_columns = ", ".join(
          [f"input_col_{i}" for i in range(len(frame))]
      )
      input_offsets = ", ".join(
          [f"offset_{i}" for i in range(len(frame))]
      )
      extra_args = ", ".join(
          [f"extra_arg_{i}" for i in range(len(args))]
      )
  
      # Generate the initializers for each device function argument
      initializers = []
      row_initializers = []
      for i, (colname, col) in enumerate(frame.items()):
          idx = str(i)
          template = (
              masked_input_initializer_template
              if col.mask is not None
              else unmasked_input_initializer_template
          )
          initializers.append(template.format(idx=idx))
          row_initializers.append(
              row_initializer_template.format(idx=idx, name=colname)
          )
  
      return row_kernel_template.format(
          input_columns=input_columns,
          input_offsets=input_offsets,
          extra_args=extra_args,
          masked_input_initializers="\n".join(initializers),
          row_initializers="\n".join(row_initializers),
          numba_rectype=row_type,
      )
  
file_path: cudf/python/cudf/cudf/core/udf/row_function.py
imports: import math
  import numpy
  from numba import cuda
  from numba.np import numpy_support
  from cudf.core.udf.api import Masked, pack_return
  from cudf.core.udf.masked_typing import MaskedType
  from cudf.core.udf.strings_typing import string_view
  from cudf.core.udf.templates import masked_input_initializer_template, row_initializer_template, row_kernel_template, unmasked_input_initializer_template
  from cudf.core.udf.utils import Row, _all_dtypes_from_frame, _construct_signature, _get_extensionty_size, _get_kernel, _get_udf_return_type, _mask_get, _supported_cols_from_frame, _supported_dtypes_from_frame
label_desc: Use image node_id 2 for calling a global function with example usage: _row_kernel_string_from_template(frame, row_type, args) and returns: row_kernel_template