code: def FanoutSlices(  # pylint: disable=invalid-name
      pcoll: beam.pvalue.PCollection,
      include_slice_keys_in_output: Optional[bool] = False,
  ) -> beam.pvalue.PCollection:  # pylint: disable=invalid-name
      """Fan out extracts based on slice keys (slice keys removed by default)."""
      if include_slice_keys_in_output:
          key_filter_fn = lambda k: True
      else:
          pruned_keys = (
              constants.SLICE_KEY_TYPES_KEY,
              constants.SLICE_KEYS_KEY,
          )
          key_filter_fn = lambda k: k not in pruned_keys
  
      result = pcoll | "DoSlicing" >> beam.ParDo(
          _FanoutSlicesDoFn(key_filter_fn)
      )
  
      # pylint: disable=no-value-for-parameter
      _ = result | "TrackDistinctSliceKeys" >> _TrackDistinctSliceKeys()
      # pylint: enable=no-value-for-parameter
  
      return result
  
imports: import itertools
  from typing import Any, Callable, Dict, Generator, Iterable, List, NamedTuple, Optional, Tuple, Union
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.proto import metrics_for_slice_pb2
  from tensorflow_model_analysis.slicer import slice_accessor
label_desc: Use image node_id 15 for calling a global function with example usage: FanoutSlices(pcoll, include_slice_keys_in_output) and returns: result