code: def serialize_primitive(primitive: PrimitiveBase):
      """build a dictionary with the data necessary to construct the given primitive"""
      args_dict = {name: val for name, val in primitive.get_arguments()}
      cls = type(primitive)
      if cls == NumberOfCommonWords and "word_set" in args_dict:
          args_dict["word_set"] = list(args_dict["word_set"])
      return {
          "type": cls.__name__,
          "module": cls.__module__,
          "arguments": args_dict,
      }
  
imports: import importlib.util
  import os
  from inspect import getfullargspec, getsource, isclass
  from typing import Dict, List
  import pandas
  from woodwork import list_logical_types, list_semantic_tags, type_system
  from woodwork.column_schema import ColumnSchema
  from woodwork.logical_types import NaturalLanguage
  import featuretools
  from featuretools.primitives import NumberOfCommonWords
  from featuretools.primitives.base import AggregationPrimitive, PrimitiveBase, TransformPrimitive
  from featuretools.utils.gen_utils import Library, find_descendents
label_desc: Use image node_id 18 for calling a global function with example usage: serialize_primitive(primitive) and returns: dict