code: def sanitize_arrow_table(pa_table):
      """Sanitize arrow table for JSON serialization"""
      import pyarrow as pa
      import pyarrow.compute as pc
  
      arrays = []
      schema = pa_table.schema
      for name in schema.names:
          array = pa_table[name]
          dtype = schema.field(name).type
          if str(dtype).startswith("timestamp"):
              arrays.append(pc.strftime(array))
          elif str(dtype).startswith("duration"):
              raise ValueError(
                  'Field "{col_name}" has type "{dtype}" which is '
                  "not supported by Altair. Please convert to "
                  "either a timestamp or a numerical value."
                  "".format(col_name=name, dtype=dtype)
              )
          else:
              arrays.append(array)
  
      return pa.Table.from_arrays(arrays, names=schema.names)
  
imports: from collections.abc import Mapping, MutableMapping
  from copy import deepcopy
  import json
  import itertools
  import re
  import sys
  import traceback
  import warnings
  from typing import Callable, TypeVar, Any, Union, Dict, Optional, Tuple, Sequence, Type, cast
  from types import ModuleType
  import jsonschema
  import pandas
  import numpy
  from pandas.api.types import infer_dtype
  from altair.utils.schemapi import SchemaBase
  from altair.utils._dfi_types import Column, DtypeKind, DataFrame
  from typing import Literal, Protocol, TYPE_CHECKING
label_desc: Use image node_id 6 for calling a global function with example usage: sanitize_arrow_table(pa_table) and returns: pa