code: def _do_extraction(
      df,
      column_id,
      column_value,
      column_kind,
      column_sort,
      default_fc_parameters,
      kind_to_fc_parameters,
      n_jobs,
      chunk_size,
      disable_progressbar,
      show_warnings,
      distributor,
      pivot,
  ):
      """
      Wrapper around the _do_extraction_on_chunk, which calls it on all chunks in the data frame.
      A chunk is a subset of the data, with a given kind and id - so a single time series.
  
      The data is separated out into those single time series and the _do_extraction_on_chunk is
      called on each of them. The results are then combined into a single pandas DataFrame.
  
      The call is either happening in parallel or not and is showing a progress bar or not depending
      on the given flags.
  
      :param df: The dataframe in the normalized format which is used for extraction.
      :type df: pd.DataFrame
  
      :param default_fc_parameters: mapping from feature calculator names to parameters. Only those names
             which are keys in this dict will be calculated. See the class:`ComprehensiveFCParameters` for
             more information.
      :type default_fc_parameters: dict
  
      :param kind_to_fc_parameters: mapping from kind names to objects of the same type as the ones for
              default_fc_parameters. If you put a kind as a key here, the fc_parameters
              object (which is the value), will be used instead of the default_fc_parameters.
      :type kind_to_fc_parameters: dict
  
      :param column_id: The name of the id column to group by.
      :type column_id: str
  
      :param column_kind: The name of the column keeping record on the kind of the value.
      :type column_kind: str
  
      :param column_value: The name for the column keeping the value itself.
      :type column_value: str
  
      :param chunk_size: The size of one chunk for the parallelization
      :type chunk_size: None or int
  
      :param n_jobs: The number of processes to use for parallelization. If zero, no parallelization is used.
      :type n_jobs: int
  
      :param disable_progressbar: Do not show a progressbar while doing the calculation.
      :type disable_progressbar: bool
  
      :param show_warnings: Show warnings during the feature extraction (needed for debugging of calculators).
      :type show_warnings: bool
  
      :param distributor: Advanced parameter:  See the utilities/distribution.py for more information.
                           Leave to None, if you want TSFresh to choose the best distributor.
      :type distributor: DistributorBaseClass
  
      :return: the extracted features
      :rtype: pd.DataFrame
      """
  
      data = to_tsdata(
          df, column_id, column_kind, column_value, column_sort
      )
  
      if distributor is None:
          if isinstance(data, Iterable):
              if n_jobs == 0 or n_jobs == 1:
                  distributor = MapDistributor(
                      disable_progressbar=disable_progressbar,
                      progressbar_title="Feature Extraction",
                  )
              else:
                  distributor = MultiprocessingDistributor(
                      n_workers=n_jobs,
                      disable_progressbar=disable_progressbar,
                      progressbar_title="Feature Extraction",
                      show_warnings=show_warnings,
                  )
          else:
              distributor = ApplyDistributor(
                  meta=[
                      (data.column_id, "int64"),
                      ("variable", "object"),
                      ("value", "float64"),
                  ]
              )
  
      if not isinstance(distributor, DistributorBaseClass):
          raise ValueError(
              "the passed distributor is not an DistributorBaseClass object"
          )
  
      kwargs = dict(
          default_fc_parameters=default_fc_parameters,
          kind_to_fc_parameters=kind_to_fc_parameters,
          show_warnings=show_warnings,
      )
  
      result = distributor.map_reduce(
          _do_extraction_on_chunk,
          data=data,
          chunk_size=chunk_size,
          function_kwargs=kwargs,
      )
  
      if not pivot:
          return result
  
      return_df = data.pivot(result)
      return return_df
  
file_path: tsfresh/tsfresh/feature_extraction/extraction.py
imports: import logging
  import warnings
  from collections.abc import Iterable
  import pandas
  from tsfresh import defaults
  from tsfresh.feature_extraction import feature_calculators
  from tsfresh.feature_extraction.data import to_tsdata
  from tsfresh.feature_extraction.settings import ComprehensiveFCParameters
  from tsfresh.utilities import profiling
  from tsfresh.utilities.distribution import ApplyDistributor, DistributorBaseClass, MapDistributor, MultiprocessingDistributor
  from tsfresh.utilities.string_manipulation import convert_to_output_format
label_desc: Use image node_id 2 for calling a global function with example usage: _do_extraction(df, column_id, column_value, column_kind, column_sort, default_fc_parameters, kind_to_fc_parameters, n_jobs, chunk_size, disable_progressbar, show_warnings, distributor, pivot) and returns: return_df, result