code: def _decorate_compute_function(
      wrapper, exposed_name, func, options_class
  ):
      # Decorate the given compute function wrapper with useful metadata
      # and documentation.
      cpp_doc = func._doc
  
      wrapper.__arrow_compute_function__ = dict(
          name=func.name,
          arity=func.arity,
          options_class=cpp_doc.options_class,
          options_required=cpp_doc.options_required,
      )
      wrapper.__name__ = exposed_name
      wrapper.__qualname__ = exposed_name
  
      doc_pieces = []
  
      # 1. One-line summary
      summary = cpp_doc.summary
      if not summary:
          arg_str = "arguments" if func.arity > 1 else "argument"
          summary = (
              "Call compute function {!r} with the given {}".format(
                  func.name, arg_str
              )
          )
  
      doc_pieces.append(f"{summary}.\n\n")
  
      # 2. Multi-line description
      description = cpp_doc.description
      if description:
          doc_pieces.append(f"{description}\n\n")
  
      doc_addition = _compute_docstrings.function_doc_additions.get(
          func.name
      )
  
      # 3. Parameter description
      doc_pieces.append(
          dedent(
              """\
          Parameters
          ----------
          """
          )
      )
  
      # 3a. Compute function parameters
      arg_names = _get_arg_names(func)
      for arg_name in arg_names:
          if func.kind in ("vector", "scalar_aggregate"):
              arg_type = "Array-like"
          else:
              arg_type = "Array-like or scalar-like"
          doc_pieces.append(f"{arg_name} : {arg_type}\n")
          doc_pieces.append("    Argument to compute function.\n")
  
      # 3b. Compute function option values
      if options_class is not None:
          options_class_doc = _scrape_options_class_doc(options_class)
          if options_class_doc:
              for p in options_class_doc.params:
                  doc_pieces.append(f"{p.name} : {p.type}\n")
                  for s in p.desc:
                      doc_pieces.append(f"    {s}\n")
          else:
              warnings.warn(
                  f"Options class {options_class.__name__} "
                  f"does not have a docstring",
                  RuntimeWarning,
              )
              options_sig = inspect.signature(options_class)
              for p in options_sig.parameters.values():
                  doc_pieces.append(
                      dedent(
                          """\
                  {0} : optional
                      Parameter for {1} constructor. Either `options`
                      or `{0}` can be passed, but not both at the same time.
                  """.format(
                              p.name, options_class.__name__
                          )
                      )
                  )
          doc_pieces.append(
              dedent(
                  f"""\
              options : pyarrow.compute.{options_class.__name__}, optional
                  Alternative way of passing options.
              """
              )
          )
  
      doc_pieces.append(
          dedent(
              """\
          memory_pool : pyarrow.MemoryPool, optional
              If not passed, will allocate memory from the default memory pool.
          """
          )
      )
  
      # 4. Custom addition (e.g. examples)
      if doc_addition is not None:
          doc_pieces.append(
              "\n{}\n".format(dedent(doc_addition).strip("\n"))
          )
  
      wrapper.__doc__ = "".join(doc_pieces)
      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 3 for calling a global function with example usage: _decorate_compute_function(wrapper, exposed_name, func, options_class) and returns: wrapper