code: def check_primitive(
      primitive,
      prim_type,
      aggregation_primitive_dict,
      transform_primitive_dict,
  ):
      if prim_type in ("transform", "groupby transform"):
          prim_dict = transform_primitive_dict
          supertype = TransformPrimitive
          arg_name = (
              "trans_primitives"
              if prim_type == "transform"
              else "groupby_trans_primitives"
          )
          s = "a transform"
      if prim_type in ("aggregation", "where"):
          prim_dict = aggregation_primitive_dict
          supertype = AggregationPrimitive
          arg_name = (
              "agg_primitives"
              if prim_type == "aggregation"
              else "where_primitives"
          )
          s = "an aggregation"
  
      if isinstance(primitive, str):
          prim_string = camel_and_title_to_snake(primitive)
          if prim_string not in prim_dict:
              raise ValueError(
                  "Unknown {} primitive {}. "
                  "Call ft.primitives.list_primitives() to get"
                  " a list of available primitives".format(
                      prim_type, prim_string
                  ),
              )
          primitive = prim_dict[prim_string]
      primitive = handle_primitive(primitive)
      if not isinstance(primitive, supertype):
          raise ValueError(
              "Primitive {} in {} is not {} "
              "primitive".format(
                  type(primitive),
                  arg_name,
                  s,
              ),
          )
      return primitive
  
imports: import functools
  import logging
  import operator
  import warnings
  from collections import defaultdict
  from typing import Any, DefaultDict, Dict, List, Tuple, Type
  from woodwork.column_schema import ColumnSchema
  from woodwork.logical_types import Boolean, BooleanNullable
  from featuretools import primitives
  from featuretools.entityset.entityset import LTI_COLUMN_NAME
  from featuretools.entityset.relationship import RelationshipPath
  from featuretools.feature_base import AggregationFeature, DirectFeature, FeatureBase, GroupByTransformFeature, IdentityFeature, TransformFeature
  from featuretools.feature_base.cache import CacheType, feature_cache
  from featuretools.feature_base.utils import is_valid_input
  from featuretools.primitives.base import AggregationPrimitive, PrimitiveBase, TransformPrimitive
  from featuretools.primitives.options_utils import filter_groupby_matches_by_options, filter_matches_by_options, generate_all_primitive_options, ignore_dataframe_for_primitive
  from featuretools.utils.gen_utils import Library, camel_and_title_to_snake
label_desc: Use image node_id 10 for calling a global function with example usage: check_primitive(primitive, prim_type, aggregation_primitive_dict, transform_primitive_dict) and returns: primitive