code: def _get_udf_return_type(argty, func: Callable, args=()):
      """
      Get the return type of a masked UDF for a given set of argument dtypes. It
      is assumed that the function consumes a dictionary whose keys are strings
      and whose values are of MaskedType. Initially assume that the UDF may be
      written to utilize any field in the row - including those containing an
      unsupported dtype. If an unsupported dtype is actually used in the function
      the compilation should fail at `compile_udf`. If compilation succeeds, one
      can infer that the function does not use any of the columns of unsupported
      dtype - meaning we can drop them going forward and the UDF will still end
      up getting fed rows containing all the fields it actually needs to use to
      compute the answer for that row.
      """
  
      # present a row containing all fields to the UDF and try and compile
      compile_sig = (argty, *(typeof(arg) for arg in args))
  
      # Get the return type. The PTX is also returned by compile_udf, but is not
      # needed here.
      with _CUDFNumbaConfig():
          ptx, output_type = cudautils.compile_udf(func, compile_sig)
  
      if not isinstance(output_type, MaskedType):
          numba_output_type = numpy_support.from_dtype(
              np.dtype(output_type)
          )
      else:
          numba_output_type = output_type
  
      result = (
          numba_output_type
          if not isinstance(numba_output_type, MaskedType)
          else numba_output_type.value_type
      )
      result = result if result.is_internal else result.return_type
  
      # _get_udf_return_type will throw a TypingError if the user tries to use
      # a field in the row containing an unsupported dtype, except in the
      # edge case where all the function does is return that element:
  
      # def f(row):
      #    return row[<bad dtype key>]
      # In this case numba is happy to return MaskedType(<bad dtype key>)
      # because it relies on not finding overloaded operators for types to raise
      # the exception, so we have to explicitly check for that case.
      if isinstance(result, Poison):
          raise TypingError(str(result))
  
      return result
  
imports: import os
  from typing import Any, Callable, Dict
  import cachetools
  import cupy
  import llvmlite.binding
  import numpy
  from cuda import cudart
  from numba import cuda, typeof
  from numba.core.datamodel import default_manager, models
  from numba.core.errors import TypingError
  from numba.core.extending import register_model
  from numba.np import numpy_support
  from numba.types import CPointer, Poison, Record, Tuple, boolean, int64, void
  import rmm
  from cudf._lib.strings_udf import column_from_udf_string_array, column_to_string_view_array
  from cudf.api.types import is_scalar
  from cudf.core.column.column import as_column
  from cudf.core.dtypes import dtype
  from cudf.core.udf.masked_typing import MaskedType
  from cudf.core.udf.strings_typing import str_view_arg_handler, string_view, udf_string
  from cudf.utils import cudautils
  from cudf.utils._numba import _CUDFNumbaConfig, _get_ptx_file
  from cudf.utils.dtypes import BOOL_TYPES, DATETIME_TYPES, NUMERIC_TYPES, STRING_TYPES, TIMEDELTA_TYPES
  from cudf.utils.nvtx_annotation import _cudf_nvtx_annotate
  from cudf.utils.utils import initfunc
label_desc: Use image node_id 1 for calling a global function with example usage: _get_udf_return_type(argty, func, args) and returns: result