code: def flatten_primitives(self) -> Dict[str, Dict[str, Any]]:
      all_primitives_dict: Dict[str, Dict[str, Any]] = {}
  
      def rfunc(feature_list: List[LiteFeature]):
          for feature in feature_list:
              if feature.primitive:
                  key, prim_dict = hash_primitive(feature.primitive)
                  all_primitives_dict.setdefault(key, prim_dict)
              rfunc(feature.base_features)
  
      rfunc(self._all_features)
      return all_primitives_dict
  
imports: from __future__ import annotations
  import hashlib
  from itertools import combinations
  from typing import Any, Dict, List, Optional, Set, Type, Union, cast
  from woodwork.logical_types import LogicalType
  from featuretools.feature_discovery.LiteFeature import LiteFeature
  from featuretools.feature_discovery.type_defs import ANY
  from featuretools.feature_discovery.utils import hash_primitive, logical_types_map
  from featuretools.primitives.base.primitive_base import PrimitiveBase
  from featuretools.primitives.utils import PrimitivesDeserializer
label_desc: Use image node_id 17 for calling the FeatureCollection obj's underlying member method code with example usage: obj.flatten_primitives() and returns: all_primitives_dict