code: def _reconstruct_index(
      table, index_descriptors, all_columns, types_mapper=None
  ):
      # 0. 'field_name' is the name of the column in the arrow Table
      # 1. 'name' is the user-facing name of the column, that is, it came from
      #    pandas
      # 2. 'field_name' and 'name' differ for index columns
      # 3. We fall back on c['name'] for backwards compatibility
      field_name_to_metadata = {
          c.get("field_name", c["name"]): c for c in all_columns
      }
  
      # Build up a list of index columns and names while removing those columns
      # from the original table
      index_arrays = []
      index_names = []
      result_table = table
      for descr in index_descriptors:
          if isinstance(descr, str):
              (
                  result_table,
                  index_level,
                  index_name,
              ) = _extract_index_level(
                  table,
                  result_table,
                  descr,
                  field_name_to_metadata,
                  types_mapper,
              )
              if index_level is None:
                  # ARROW-1883: the serialized index column was not found
                  continue
          elif descr["kind"] == "range":
              index_name = descr["name"]
              index_level = _pandas_api.pd.RangeIndex(
                  descr["start"],
                  descr["stop"],
                  step=descr["step"],
                  name=index_name,
              )
              if len(index_level) != len(table):
                  # Possibly the result of munged metadata
                  continue
          else:
              raise ValueError(
                  "Unrecognized index kind: {}".format(descr["kind"])
              )
          index_arrays.append(index_level)
          index_names.append(index_name)
  
      pd = _pandas_api.pd
  
      # Reconstruct the row index
      if len(index_arrays) > 1:
          index = pd.MultiIndex.from_arrays(
              index_arrays, names=index_names
          )
      elif len(index_arrays) == 1:
          index = index_arrays[0]
          if not isinstance(index, pd.Index):
              # Box anything that wasn't boxed above
              index = pd.Index(index, name=index_names[0])
      else:
          index = pd.RangeIndex(table.num_rows)
  
      return result_table, index
  
imports: import ast
  from collections.abc import Sequence
  from concurrent import futures
  import concurrent.futures.thread
  from copy import deepcopy
  from itertools import zip_longest
  import json
  import operator
  import re
  import warnings
  import numpy
  import pyarrow
  from pyarrow.lib import _pandas_api, frombytes
label_desc: Use image node_id 26 for calling a global function with example usage: _reconstruct_index(table, index_descriptors, all_columns, types_mapper) and returns: result_table,  index