code: def test_stacked(es, trans_feat):
      stacked = AggregationFeature(trans_feat, "cohorts", Mode)
      graph = graph_feature(stacked).source
  
      feat_name = stacked.get_name()
      intermediate_name = trans_feat.get_name()
      agg_primitive = "0_{}_mode".format(feat_name)
      trans_primitive = "1_{}_year".format(intermediate_name)
      groupby_node = "{}_groupby_customers--cohort".format(feat_name)
  
      trans_prim_edge = 'customers:cancel_date -> "{}"'.format(
          trans_primitive
      )
      intermediate_edge = '"{}" -> customers:"{}"'.format(
          trans_primitive,
          intermediate_name,
      )
      groupby_edge = 'customers:cohort -> "{}"'.format(groupby_node)
      groupby_input = 'customers:"{}" -> "{}"'.format(
          intermediate_name, groupby_node
      )
      agg_input = '"{}" -> "{}"'.format(groupby_node, agg_primitive)
      feat_edge = '"{}" -> cohorts:"{}"'.format(
          agg_primitive, feat_name
      )
  
      graph_components = [
          feat_name,
          intermediate_name,
          agg_primitive,
          trans_primitive,
          groupby_node,
          trans_prim_edge,
          intermediate_edge,
          groupby_edge,
          groupby_input,
          agg_input,
          feat_edge,
      ]
      for component in graph_components:
          assert component in graph
  
      agg_primitive = agg_primitive.replace("(", "\\(").replace(
          ")", "\\)"
      )
      agg_node = re.findall(
          '"{}" \\[label.*'.format(agg_primitive), graph
      )
      assert len(agg_node) == 1
      assert "Step 2" in agg_node[0]
  
      trans_primitive = trans_primitive.replace("(", "\\(").replace(
          ")", "\\)"
      )
      trans_node = re.findall(
          '"{}" \\[label.*'.format(trans_primitive), graph
      )
      assert len(trans_node) == 1
      assert "Step 1" in trans_node[0]
  
imports: import json
  import os
  import re
  import graphviz
  import pytest
  from featuretools.feature_base import AggregationFeature, DirectFeature, FeatureOutputSlice, GroupByTransformFeature, IdentityFeature, TransformFeature, graph_feature
  from featuretools.primitives import Count, CumMax, Mode, NMostCommon, Year
label_desc: Use image node_id 14 for calling a global function with example usage: test_stacked(es, trans_feat) without return types