code: def cast(
      arr, target_type=None, safe=None, options=None, memory_pool=None
  ):
      """
      Cast array values to another data type. Can also be invoked as an array
      instance method.
  
      Parameters
      ----------
      arr : Array-like
      target_type : DataType or str
          Type to cast to
      safe : bool, default True
          Check for overflows or other unsafe conversions
      options : CastOptions, default None
          Additional checks pass by CastOptions
      memory_pool : MemoryPool, optional
          memory pool to use for allocations during function execution.
  
      Examples
      --------
      >>> from datetime import datetime
      >>> import pyarrow as pa
      >>> arr = pa.array([datetime(2010, 1, 1), datetime(2015, 1, 1)])
      >>> arr.type
      TimestampType(timestamp[us])
  
      You can use ``pyarrow.DataType`` objects to specify the target type:
  
      >>> cast(arr, pa.timestamp('ms'))
      <pyarrow.lib.TimestampArray object at ...>
      [
        2010-01-01 00:00:00.000,
        2015-01-01 00:00:00.000
      ]
  
      >>> cast(arr, pa.timestamp('ms')).type
      TimestampType(timestamp[ms])
  
      Alternatively, it is also supported to use the string aliases for these
      types:
  
      >>> arr.cast('timestamp[ms]')
      <pyarrow.lib.TimestampArray object at ...>
      [
        2010-01-01 00:00:00.000,
        2015-01-01 00:00:00.000
      ]
      >>> arr.cast('timestamp[ms]').type
      TimestampType(timestamp[ms])
  
      Returns
      -------
      casted : Array
          The cast result as a new Array
      """
      safe_vars_passed = (safe is not None) or (target_type is not None)
  
      if safe_vars_passed and (options is not None):
          raise ValueError(
              "Must either pass values for 'target_type' and 'safe'"
              " or pass a value for 'options'"
          )
  
      if options is None:
          target_type = pa.types.lib.ensure_type(target_type)
          if safe is False:
              options = CastOptions.unsafe(target_type)
          else:
              options = CastOptions.safe(target_type)
      return call_function("cast", [arr], options, memory_pool)
  
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 10 for calling a global function with example usage: cast(arr, target_type, safe, options, memory_pool) and returns: call_function