code: def _surface_attributes(
      features: List[List[Dict[Text, List["Features"]]]],
      featurizers: Optional[List[Text]] = None,
  ) -> DefaultDict[Text, List[List[Optional[List["Features"]]]]]:
      """Restructure the input.
  
      "features" can, for example, be a dictionary of attributes (INTENT,
      TEXT, ACTION_NAME, ACTION_TEXT, ENTITIES, SLOTS, FORM) to a list of features for
      all dialogue turns in all training trackers.
      For NLU training it would just be a dictionary of attributes (either INTENT or
      RESPONSE, TEXT, and potentially ENTITIES) to a list of features for all training
      examples.
  
      The incoming "features" contain a dictionary as inner most value. This method
      surfaces this dictionary, so that it becomes the outer most value.
  
      Args:
          features: a dictionary of attributes to a list of features for all
              examples in the training data
          featurizers: the featurizers to consider
  
      Returns:
          A dictionary of attributes to a list of features for all examples.
      """
      # collect all attributes
      attributes = set(
          attribute
          for list_of_attribute_to_features in features
          for attribute_to_features in list_of_attribute_to_features
          for attribute in attribute_to_features.keys()
      )
  
      output = defaultdict(list)
      for list_of_attribute_to_features in features:
          intermediate_features = defaultdict(list)
          for attribute_to_features in list_of_attribute_to_features:
              for attribute in attributes:
                  attribute_features = attribute_to_features.get(
                      attribute
                  )
                  if featurizers:
                      attribute_features = _filter_features(
                          attribute_features, featurizers
                      )
  
                  # if attribute is not present in the example, populate it with None
                  intermediate_features[attribute].append(
                      attribute_features
                  )
  
          for (
              key,
              collection_of_feature_collections,
          ) in intermediate_features.items():
              output[key].append(collection_of_feature_collections)
  
      return output
  
imports: import typing
  import copy
  import numpy
  import scipy.sparse
  from collections import defaultdict, OrderedDict
  from typing import List, Optional, Text, Dict, Tuple, Union, Any, DefaultDict, cast
  from rasa.nlu.constants import TOKENS_NAMES
  from rasa.utils.tensorflow.model_data import Data, FeatureArray, ragged_array_to_ndarray
  from rasa.utils.tensorflow.constants import MASK, IDS
  from rasa.shared.nlu.training_data.message import Message
  from rasa.shared.nlu.constants import TEXT, ENTITIES, ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_GROUP, ENTITY_ATTRIBUTE_ROLE
label_desc: Use image node_id 4 for calling a global function with example usage: _surface_attributes(features, featurizers) and returns: output