code: def test_handles_primitive_function_name_uniqueness(es):
      if es.dataframe_type != Library.PANDAS:
          pytest.xfail(
              "Fails with Dask and Spark due conflicting aggregation primitive names",
          )
  
      class SumTimesN(AggregationPrimitive):
          name = "sum_times_n"
          input_types = [ColumnSchema(semantic_tags={"numeric"})]
          return_type = ColumnSchema(semantic_tags={"numeric"})
  
          def __init__(self, n):
              self.n = n
  
          def get_function(self, agg_type="pandas"):
              def my_function(values):
                  return values.sum() * self.n
  
              return my_function
  
      # works as expected
      f1 = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=SumTimesN(n=1),
      )
      fm = calculate_feature_matrix(features=[f1], entityset=es)
  
      value_sum = pd.Series([56, 26, 0])
      assert all(fm[f1.get_name()].sort_index() == value_sum)
  
      # works as expected
      f2 = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=SumTimesN(n=2),
      )
      fm = calculate_feature_matrix(features=[f2], entityset=es)
  
      double_value_sum = pd.Series([112, 52, 0])
      assert all(fm[f2.get_name()].sort_index() == double_value_sum)
  
      # same primitive, same column, different args
      fm = calculate_feature_matrix(features=[f1, f2], entityset=es)
  
      assert all(fm[f1.get_name()].sort_index() == value_sum)
      assert all(fm[f2.get_name()].sort_index() == double_value_sum)
  
      # different primitives, same function returned by get_function,
      # different base features
      f3 = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=Sum,
      )
      f4 = Feature(
          es["log"].ww["purchased"],
          parent_dataframe_name="customers",
          primitive=NumTrue,
      )
      fm = calculate_feature_matrix(features=[f3, f4], entityset=es)
  
      purchased_sum = pd.Series([10, 1, 1])
      assert all(fm[f3.get_name()].sort_index() == value_sum)
      assert all(fm[f4.get_name()].sort_index() == purchased_sum)
  
      # different primitives, same function returned by get_function,
      # same base feature
      class Sum1(AggregationPrimitive):
          """Sums elements of a numeric or boolean feature."""
  
          name = "sum1"
          input_types = [ColumnSchema(semantic_tags={"numeric"})]
          return_type = ColumnSchema(semantic_tags={"numeric"})
          stack_on_self = False
          stack_on_exclude = [Count]
          default_value = 0
  
          def get_function(self, agg_type="pandas"):
              return np.sum
  
      class Sum2(AggregationPrimitive):
          """Sums elements of a numeric or boolean feature."""
  
          name = "sum2"
          input_types = [ColumnSchema(semantic_tags={"numeric"})]
          return_type = ColumnSchema(semantic_tags={"numeric"})
          stack_on_self = False
          stack_on_exclude = [Count]
          default_value = 0
  
          def get_function(self, agg_type="pandas"):
              return np.sum
  
      class Sum3(AggregationPrimitive):
          """Sums elements of a numeric or boolean feature."""
  
          name = "sum3"
          input_types = [ColumnSchema(semantic_tags={"numeric"})]
          return_type = ColumnSchema(semantic_tags={"numeric"})
          stack_on_self = False
          stack_on_exclude = [Count]
          default_value = 0
  
          def get_function(self, agg_type="pandas"):
              return np.sum
  
      f5 = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=Sum1,
      )
      f6 = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=Sum2,
      )
      f7 = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=Sum3,
      )
      fm = calculate_feature_matrix(features=[f5, f6, f7], entityset=es)
      assert all(fm[f5.get_name()].sort_index() == value_sum)
      assert all(fm[f6.get_name()].sort_index() == value_sum)
      assert all(fm[f7.get_name()].sort_index() == value_sum)
  
imports: from datetime import datetime
  import numpy
  import pandas
  import pytest
  from woodwork.column_schema import ColumnSchema
  from woodwork.logical_types import Categorical, Datetime, Double, Integer
  from featuretools import AggregationFeature, EntitySet, Feature, Timedelta, calculate_feature_matrix
  from featuretools.computational_backends.feature_set import FeatureSet
  from featuretools.computational_backends.feature_set_calculator import FeatureSetCalculator
  from featuretools.entityset.relationship import RelationshipPath
  from featuretools.feature_base import DirectFeature, IdentityFeature
  from featuretools.primitives import And, Count, CumSum, EqualScalar, GreaterThanEqualToScalar, GreaterThanScalar, LessThanEqualToScalar, LessThanScalar, Mean, Min, Mode, Negate, NMostCommon, NotEqualScalar, NumTrue, Sum, TimeSinceLast, Trend
  from featuretools.primitives.base import AggregationPrimitive
  from featuretools.tests.testing_utils import backward_path, to_pandas
  from featuretools.utils import Trie
  from featuretools.utils.gen_utils import Library, import_or_none, is_instance
label_desc: Use image node_id 39 for calling a global function with example usage: test_handles_primitive_function_name_uniqueness(es) and returns: my_function, np, np, np, unknown