code: def _make_generic_wrapper(func_name, func, options_class, arity):
      if options_class is None:
  
          def wrapper(*args, memory_pool=None):
              if arity is not Ellipsis and len(args) != arity:
                  raise TypeError(
                      f"{func_name} takes {arity} positional argument(s), "
                      f"but {len(args)} were given"
                  )
              if args and isinstance(args[0], Expression):
                  return Expression._call(func_name, list(args))
              return func.call(args, None, memory_pool)
  
      else:
  
          def wrapper(*args, memory_pool=None, options=None, **kwargs):
              if arity is not Ellipsis:
                  if len(args) < arity:
                      raise TypeError(
                          f"{func_name} takes {arity} positional argument(s), "
                          f"but {len(args)} were given"
                      )
                  option_args = args[arity:]
                  args = args[:arity]
              else:
                  option_args = ()
              options = _handle_options(
                  func_name, options_class, options, option_args, kwargs
              )
              if args and isinstance(args[0], Expression):
                  return Expression._call(
                      func_name, list(args), options
                  )
              return func.call(args, options, memory_pool)
  
      return wrapper
  
imports: from pyarrow._compute import Function, FunctionOptions, FunctionRegistry, HashAggregateFunction, HashAggregateKernel, Kernel, ScalarAggregateFunction, ScalarAggregateKernel, ScalarFunction, ScalarKernel, VectorFunction, VectorKernel, ArraySortOptions, AssumeTimezoneOptions, CastOptions, CountOptions, CumulativeOptions, CumulativeSumOptions, DayOfWeekOptions, DictionaryEncodeOptions, RunEndEncodeOptions, ElementWiseAggregateOptions, ExtractRegexOptions, FilterOptions, IndexOptions, JoinOptions, ListSliceOptions, MakeStructOptions, MapLookupOptions, MatchSubstringOptions, ModeOptions, NullOptions, PadOptions, PairwiseOptions, PartitionNthOptions, QuantileOptions, RandomOptions, RankOptions, ReplaceSliceOptions, ReplaceSubstringOptions, RoundBinaryOptions, RoundOptions, RoundTemporalOptions, RoundToMultipleOptions, ScalarAggregateOptions, SelectKOptions, SetLookupOptions, SliceOptions, SortOptions, SplitOptions, SplitPatternOptions, StrftimeOptions, StrptimeOptions, StructFieldOptions, TakeOptions, TDigestOptions, TrimOptions, Utf8NormalizeOptions, VarianceOptions, WeekOptions, call_function, function_registry, get_function, list_functions, call_tabular_function, register_scalar_function, register_tabular_function, register_aggregate_function, register_vector_function, UdfContext, Expression
  from collections import namedtuple
  import inspect
  from textwrap import dedent
  import warnings
  import pyarrow
  from pyarrow import _compute_docstrings
  from pyarrow.vendored import docscrape
label_desc: Use image node_id 6 for calling a global function with example usage: _make_generic_wrapper(func_name, func, options_class, arity) and returns: wrapper, func, func, Expression, Expression