code: def filter_coef_summary(
      coef_summary,
      pred_category,
      is_intercept=None,
      is_time_feature=None,
      is_event=None,
      is_trend=None,
      is_seasonality=None,
      is_lag=None,
      is_regressor=None,
      is_interaction=None,
  ):
      """Gets the coefficient summary df after applying the given filters.
  
      Set any of the parameters to `bool` to enable filtering.
  
          - Any argument set to True will be aggregated with logical operator "or", i.e.
            a category will be displayed when set to True.
          - Any argument set to False will be aggregated with logical operator "and", i.e.
            a category will not be displayed when set to False (even it has interaction with
            a category that is set to True).
          - Any argument set to None will be ignored unless all arguments are None.
          - ``is_interaction`` is used to exclude interaction terms by setting it
            to False. It is not used when the value is True and other argument is not None.
            The design here is to use ``is_interaction`` as a second pass filter.
  
      Parameters
      ----------
      coef_summary : `pandas.DataFrame`
          The coefficient summary df.
      pred_category : `dict`
          The predictor category dictionary by
          `~greykite.algo.common.col_name_utils.create_pred_category`.
      is_intercept : `bool` or `None`, default `None`
          Intercept or not.
      is_time_feature : `bool` or `None`, default `None`
          Time features or not.
          Time features belong to `~greykite.common.constants.TimeFeaturesEnum`.
      is_event : `bool` or `None`, default `None`
          Event features or not.
          Event features have `~greykite.common.constants.EVENT_PREFIX`.
      is_trend : `bool` or `None`, default `None`
          Trend features or not.
          Trend features have `~greykite.common.constants.CHANGEPOINT_COL_PREFIX`.
      is_seasonality : `bool` or `None`, default `None`
          Seasonality feature or not.
          Seasonality features have `~greykite.common.constants.SEASONALITY_REGEX`.
      is_lag : `bool` or `None`, default `None`
          Lagged features or not.
          Lagged features have "lag_".
      is_regressor : `bool` or `None`, default `None`
          User supplied regressor features or not.
          They are provided with the `extra_pred_cols`.
      is_interaction : `bool` or `None`, default `None`
          Interaction feature or not.
          Interaction features have ":".
  
      Returns
      -------
      filtered_coef_summary : `pandas.DataFrame`
          The filtered coefficient summary df filtered by the given conditions.
      """
      coef_summary_categorized = add_category_cols(
          coef_summary, pred_category
      )
      coef_summary_categorized["Pred_col"] = simplify_pred_cols(
          coef_summary_categorized["Pred_col"]
      )
      # And True values will be aggregated with "or".
      # Any False values will be aggregated with "and".
      # This aligns with human sense.
      conditions_true = []
      conditions_false = []
      for k, v in locals().items():
          if "is_" in k and k != "is_interaction":
              if v is not None:
                  if v:
                      conditions_true.append(f"{k} == {int(v)}")
                  else:
                      conditions_false.append(f"{k} == {int(v)}")
      query_true = f"{' or '.join(conditions_true)}"
      query_false = f"{' and '.join(conditions_false)}"
      if query_true and query_false:
          query = f"({query_true}) and ({query_false})"
      elif query_true:
          query = f"({query_true})"
      elif query_false:
          query = f"({query_false})"
      else:
          query = ""
      # Deal with is_interaction
      if query:
          if is_interaction is False:
              # When is_interaction is False, remove interaction terms.
              # By default, the filters include interaction terms.
              query = f"({query}) and (is_interaction == {int(is_interaction)})"
          new_df = coef_summary_categorized.query(query)
      else:
          # In there is no query, is_interaction is used filter rows.
          if is_interaction is not None:
              query = f"is_interaction == {int(is_interaction)}"
              new_df = coef_summary_categorized.query(query)
          else:
              new_df = coef_summary_categorized
      return new_df.reset_index(drop=True)
  
file_path: greykite/greykite/algo/common/col_name_utils.py
imports: import re
  from greykite.common import constants
label_desc: Use image node_id 8 for calling a global function with example usage: filter_coef_summary(coef_summary, pred_category, is_intercept, is_time_feature, is_event, is_trend, is_seasonality, is_lag, is_regressor, is_interaction) and returns: new_df