code: def _sanitize_table(table, new_schema, flavor):
      # TODO: This will not handle prohibited characters in nested field names
      if "spark" in flavor:
          column_data = [table[i] for i in range(table.num_columns)]
          return pa.Table.from_arrays(column_data, schema=new_schema)
      else:
          return table
  
imports: from collections import defaultdict
  from contextlib import nullcontext
  from functools import reduce
  import inspect
  import json
  import os
  import re
  import operator
  import warnings
  import pyarrow
  from pyarrow._parquet import ParquetReader, Statistics, FileMetaData, RowGroupMetaData, ColumnChunkMetaData, ParquetSchema, ColumnSchema, ParquetLogicalType, FileEncryptionProperties, FileDecryptionProperties, SortingColumn
  from pyarrow.fs import LocalFileSystem, FileSystem, FileType, _resolve_filesystem_and_path, _ensure_filesystem
  from pyarrow import filesystem
  from pyarrow.util import guid, _is_path_like, _stringify_path, _deprecate_api
label_desc: Use image node_id 6 for calling a global function with example usage: _sanitize_table(table, new_schema, flavor) and returns: pa, table