code: def check_serialize(primitive, es, target_dataframe_name="log"):
      trans_primitives = []
      agg_primitives = []
      if issubclass(primitive, AggregationPrimitive):
          agg_primitives = [primitive]
      else:
          trans_primitives = [primitive]
      features = dfs(
          entityset=es,
          target_dataframe_name=target_dataframe_name,
          agg_primitives=agg_primitives,
          trans_primitives=trans_primitives,
          max_features=-1,
          max_depth=3,
          features_only=True,
          return_types="all",
      )
  
      feat_to_serialize = None
      for feature in features:
          if feature.primitive.__class__ == primitive:
              feat_to_serialize = feature
              break
          for base_feature in feature.get_dependencies(deep=True):
              if base_feature.primitive.__class__ == primitive:
                  feat_to_serialize = base_feature
                  break
      assert feat_to_serialize is not None
  
      # Skip calculating feature matrix for long running primitives
      skip_primitives = ["elmo"]
  
      if primitive.name not in skip_primitives:
          df1 = calculate_feature_matrix(
              [feat_to_serialize], entityset=es
          )
  
      new_feat = load_features(save_features([feat_to_serialize]))[0]
      assert isinstance(new_feat, FeatureBase)
  
      if primitive.name not in skip_primitives:
          df2 = calculate_feature_matrix([new_feat], entityset=es)
          assert df1.equals(df2)
  
file_path: featuretools/featuretools/tests/primitive_tests/utils.py
imports: from inspect import signature
  import pytest
  from featuretools import FeatureBase, calculate_feature_matrix, dfs, encode_features, list_primitives, load_features, save_features
  from featuretools.primitives.base import AggregationPrimitive, PrimitiveBase
  from featuretools.tests.testing_utils import make_ecommerce_entityset
label_desc: Use image node_id 2 for calling a global function with example usage: check_serialize(primitive, es, target_dataframe_name) without return types