code: def _handle_options(name, options_class, options, args, kwargs):
      if args or kwargs:
          if options is not None:
              raise TypeError(
                  "Function {!r} called with both an 'options' argument "
                  "and additional arguments".format(name)
              )
          return options_class(*args, **kwargs)
  
      if options is not None:
          if isinstance(options, dict):
              return options_class(**options)
          elif isinstance(options, options_class):
              return options
          raise TypeError(
              "Function {!r} expected a {} parameter, got {}".format(
                  name, options_class, type(options)
              )
          )
  
      return None
  
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 5 for calling a global function with example usage: _handle_options(name, options_class, options, args, kwargs) and returns: None, options_class, options_class, options