code: def EvaluateExtracts(  # pylint: disable=invalid-name
      extracts: beam.pvalue.PCollection,
      key: str = constants.ANALYSIS_KEY,
      include: Optional[Union[Iterable[str], Dict[str, Any]]] = None,
      exclude: Optional[Union[Iterable[str], Dict[str, Any]]] = None,
  ) -> evaluator.Evaluation:
      """Creates Evaluation output for extracts.
  
      If both include and exclude are None then tfma.INPUT_KEY extracts will be
      excluded by default.
  
      Args:
        extracts: PCollection of Extracts.
        key: Name to use for key in Evaluation output.
        include: List or map of keys to include in output. Keys starting with '_'
          are automatically filtered out at write time. If a map of keys is passed
          then the keys and sub-keys that exist in the map will be included in the
          output. An empty dict behaves as a wildcard matching all keys or the value
          itself. Since matching on feature values is not currently supported, an
          empty dict must be used to represent the leaf nodes.
          For example: {'key1': {'key1-subkey': {}}, 'key2': {}}.
        exclude: List or map of keys to exclude from output. If a map of keys is
          passed then the keys and sub-keys that exist in the map will be excluded
          from the output. An empty dict behaves as a wildcard matching all keys or
          the value itself. Since matching on feature values is not currently
          supported, an empty dict must be used to represent the leaf nodes.
          For example: {'key1': {'key1-subkey': {}}, 'key2': {}}.
  
      Returns:
        Evaluation containing PCollection of Extracts.
      """
      if include is None and exclude is None:
          exclude = [constants.INPUT_KEY]
      filtered = extracts
      if include or exclude:
          filtered = extracts | extractor.Filter(
              include=include, exclude=exclude
          )
      return {key: filtered}
  
imports: from typing import Any, Dict, Iterable, Optional, Union
  import apache_beam
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.evaluators import evaluator
  from tensorflow_model_analysis.extractors import extractor
label_desc: Use image node_id 2 for calling a global function with example usage: EvaluateExtracts(extracts, key, include, exclude) and returns: dict