code: def generate_description(
      feature, feature_descriptions, primitive_templates
  ):
      # Check if feature has custom description
      if (
          feature in feature_descriptions
          or feature.unique_name() in feature_descriptions
      ):
          description = feature_descriptions.get(
              feature
          ) or feature_descriptions.get(
              feature.unique_name(),
          )
          return description
  
      # Check if identity feature:
      if isinstance(feature, ft.IdentityFeature):
          description = feature.column_schema.description
          if description is None:
              description = 'the "{}"'.format(feature.column_name)
          return description
  
      # Handle direct features
      if isinstance(feature, ft.DirectFeature):
          base_feature, direct_description = get_direct_description(
              feature
          )
          direct_base = generate_description(
              base_feature,
              feature_descriptions,
              primitive_templates,
          )
          return direct_base + direct_description
  
      # Get input descriptions
      input_descriptions = []
      input_columns = feature.base_features
      if isinstance(feature, ft.feature_base.FeatureOutputSlice):
          input_columns = feature.base_feature.base_features
  
      for input_col in input_columns:
          col_description = generate_description(
              input_col,
              feature_descriptions,
              primitive_templates,
          )
          input_descriptions.append(col_description)
  
      # Remove groupby description from input columns
      groupby_description = None
      if isinstance(feature, ft.GroupByTransformFeature):
          groupby_description = input_descriptions.pop()
  
      # Generate primitive description
      template_override = None
      if (
          feature.primitive in primitive_templates
          or feature.primitive.name in primitive_templates
      ):
          template_override = primitive_templates.get(
              feature.primitive,
          ) or primitive_templates.get(feature.primitive.name)
      slice_num = feature.n if hasattr(feature, "n") else None
      primitive_description = feature.primitive.get_description(
          input_descriptions,
          slice_num=slice_num,
          template_override=template_override,
      )
      if isinstance(feature, ft.feature_base.FeatureOutputSlice):
          feature = feature.base_feature
  
      # Generate groupby phrase if applicable
      groupby = ""
      if isinstance(feature, ft.AggregationFeature):
          groupby_description = get_aggregation_groupby(
              feature, feature_descriptions
          )
      if groupby_description is not None:
          if groupby_description.startswith("the "):
              groupby_description = groupby_description[4:]
          groupby = "for each {}".format(groupby_description)
  
      # Generate aggregation dataframe phrase with use_previous
      dataframe_description = ""
      if isinstance(feature, ft.AggregationFeature):
          if feature.use_previous:
              dataframe_description = "of the previous {} of ".format(
                  feature.use_previous.get_name().lower(),
              )
          else:
              dataframe_description = "of all instances of "
          dataframe_description += '"{}"'.format(
              feature.relationship_path[-1][1].child_dataframe.ww.name,
          )
  
      # Generate where phrase
      where = ""
      if hasattr(feature, "where") and feature.where:
          where_col = generate_description(
              feature.where.base_features[0],
              feature_descriptions,
              primitive_templates,
          )
          where = "where {} is {}".format(
              where_col, feature.where.primitive.value
          )
  
      # Join all parts of template
      description_template = [
          primitive_description,
          dataframe_description,
          where,
          groupby,
      ]
      description = " ".join(
          [phrase for phrase in description_template if phrase != ""]
      )
  
      return description
  
imports: import json
  import featuretools
label_desc: Use image node_id 2 for calling a global function with example usage: generate_description(feature, feature_descriptions, primitive_templates) and returns: description, description, description, unknown