code: def pivot_table(
      data: DataFrame,
      values=None,
      index=None,
      columns=None,
      aggfunc: AggFuncType = "mean",
      fill_value=None,
      margins: bool = False,
      dropna: bool = True,
      margins_name: Hashable = "All",
      observed: bool = False,
      sort: bool = True,
  ) -> DataFrame:
      index = _convert_by(index)
      columns = _convert_by(columns)
  
      if isinstance(aggfunc, list):
          pieces: list[DataFrame] = []
          keys = []
          for func in aggfunc:
              _table = __internal_pivot_table(
                  data,
                  values=values,
                  index=index,
                  columns=columns,
                  fill_value=fill_value,
                  aggfunc=func,
                  margins=margins,
                  dropna=dropna,
                  margins_name=margins_name,
                  observed=observed,
                  sort=sort,
              )
              pieces.append(_table)
              keys.append(getattr(func, "__name__", func))
  
          table = concat(pieces, keys=keys, axis=1)
          return table.__finalize__(data, method="pivot_table")
  
      table = __internal_pivot_table(
          data,
          values,
          index,
          columns,
          aggfunc,
          fill_value,
          margins,
          dropna,
          margins_name,
          observed,
          sort,
      )
      return table.__finalize__(data, method="pivot_table")
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Callable, Hashable, Sequence, cast
  import numpy
  from pandas._libs import lib
  from pandas._typing import AggFuncType, AggFuncTypeBase, AggFuncTypeDict, IndexLabel
  from pandas.util._decorators import Appender, Substitution
  from pandas.core.dtypes.cast import maybe_downcast_to_dtype
  from pandas.core.dtypes.common import is_extension_array_dtype, is_integer_dtype, is_list_like, is_nested_list_like, is_scalar
  from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries
  import pandas.core.common
  from pandas.core.frame import _shared_docs
  from pandas.core.groupby import Grouper
  from pandas.core.indexes.api import Index, MultiIndex, get_objs_combined_axis
  from pandas.core.reshape.concat import concat
  from pandas.core.reshape.util import cartesian_product
  from pandas.core.series import Series
label_desc: Use image node_id 1 for calling a global function with example usage: pivot_table(data, values, index, columns, aggfunc, fill_value, margins, dropna, margins_name, observed, sort) and returns: table, table