code: def _get_matching_features(
      feature_collection: FeatureCollection,
      primitive: PrimitiveBase,
  ) -> List[List[LiteFeature]]:
      """
      For a given primitive, find all feature sets that can be used to create new feature
  
      Args:
          feature_collection (FeatureCollection):
              An indexed feature collection object for efficient querying of features
          primitive (PrimitiveBase)
  
      Returns:
          List[List[LiteFeature]]
              List of feature sets
  
      Examples:
          .. code-block:: python
  
              from featuretools.feature_discovery.feature_discovery import get_matching_columns
              from woodwork.column_schema import ColumnSchema
  
              feature_groups = {
                  "ANY": ["f1", "f2", "f3"],
                  "Double": ["f1", "f2", "f3"],
                  "numeric": ["f1", "f2", "f3"],
                  "Double,numeric": ["f1", "f2", "f3"],
              }
  
              feature_sets = _get_matching_features(col_groups, AddNumeric)
  
              [
                  ["f1", "f2"],
                  ["f1", "f3"],
                  ["f2", "f3"]
              ]
      """
      column_sets = _primitive_to_columnsets(primitive=primitive)
  
      column_keys_set = [_index_column_set(c) for c in column_sets]
  
      commutative = primitive.commutative
  
      feature_sets = []
      for column_keys in column_keys_set:
          assert column_keys is not None
          feature_sets_ = _get_features(
              feature_collection=feature_collection,
              column_keys=tuple(column_keys),
              commutative=commutative,
          )
  
          feature_sets.extend(feature_sets_)
  
      return feature_sets
  
file_path: featuretools/featuretools/feature_discovery/feature_discovery.py
imports: import inspect
  from collections import defaultdict
  from itertools import combinations, permutations, product
  from typing import Iterable, List, Set, Tuple, Type, Union, cast
  from woodwork.column_schema import ColumnSchema
  from woodwork.logical_types import LogicalType
  from woodwork.table_schema import TableSchema
  from featuretools.feature_discovery.FeatureCollection import FeatureCollection
  from featuretools.feature_discovery.LiteFeature import LiteFeature
  from featuretools.feature_discovery.utils import column_schema_to_keys
  from featuretools.primitives.base.primitive_base import PrimitiveBase
  from featuretools.tests.testing_utils.generate_fake_dataframe import flatten_list
label_desc: Use image node_id 4 for calling a global function with example usage: _get_matching_features(feature_collection, primitive) and returns: feature_sets