code: def run_search(
      df: pd.DataFrame,
      target_column: str,
      ip_column: str,
      date_column: Optional[str],
      generate_features: List[str],
      # exclude_columns: List[str],
      company="IPInfo",
  ) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]:
      search_keys = {
          ip_column: SearchKey.IP,
      }
      if date_column:
          search_keys[date_column] = SearchKey.DATE
      enricher = FeaturesEnricher(
          search_keys=search_keys,
          api_key="fake_api_key",
          endpoint="http://fake_url",
          generate_features=generate_features,
          runtime_parameters=RuntimeParameters(
              properties={
                  "excludeAdsDefinitions": ",".join(
                      exclude_ads_definitions_by_company[
                          company
                      ].values()
                  )
              }
          )
          if company in exclude_ads_definitions_by_company
          else None,
          detect_missing_search_keys=False,
          raise_validation_error=True,
      )
      enricher.fit(
          df.drop(columns=target_column),
          df[target_column],
          calculate_metrics=False,
      )
      fi = enricher.get_features_info()
  
      relevant_fields = fi.rename(
          columns={
              "Source": included_in_data_listings_header,
              "Feature name": field_column_header,
          }
      )
      relevant_fields = relevant_fields.query("Provider != ''")
      relevant_fields = relevant_fields.drop(
          columns=["Coverage %", "Feature type"]
      )
  
      raw_relevant_fields = relevant_fields.copy()
  
      upgini_filter = (
          relevant_fields["Provider"].str.contains("Upgini")
          | relevant_fields[field_column_header].str.contains("_emb")
          | relevant_fields[field_column_header].str.endswith(
              "_n_tokens"
          )
          | relevant_fields[field_column_header].str.endswith("_gender")
          | relevant_fields[field_column_header].str.endswith(
              "_name_group"
          )
          | relevant_fields[field_column_header].str.endswith(
              "_sentiment_rating"
          )
      )
      upgini_data_listing = (
          "<a href='https://ipinfo.io/products/ip-database-download' target='_blank' rel='noopener noreferrer'>Optimized "
          "for ML database</a>"
      )
      # All features included in Upgini listing. Generated features included only in Upgini listing. Other combines
      relevant_fields.loc[
          upgini_filter, included_in_data_listings_header
      ] = upgini_data_listing
      relevant_fields.loc[
          ~upgini_filter, included_in_data_listings_header
      ] = (
          upgini_data_listing
          + ", "
          + relevant_fields[~upgini_filter][
              included_in_data_listings_header
          ]
      )
      relevant_fields.loc[upgini_filter, "Provider"] = "Upgini"
      raw_relevant_fields.loc[upgini_filter, "Provider"] = "Upgini"
  
      def remove_anchor(s):
          return re.sub(r"<a[^>]+>([\w\s]+)<\/a>", r"\1", s)
  
      def get_original_name(s):
          s = re.sub(r"<a.+>f_(.+)_\w+<\/a>", r"\1", s)
          return re.sub(r"f_(.+)_\w+", r"\1", s)
  
      features_df = enricher._search_task.get_all_initial_raw_features(
          "download_sample_features_from_widget",
          metrics_calculation=True,
      )
  
      def add_hint(feature):
          sample = []
          for c in features_df.columns:
              if c in feature:
                  column: pd.Series = features_df[c]
                  sample = column.dropna().sample(n=10, random_state=42)
                  if is_float_dtype(sample):
                      sample = sample.round(4)
                  sample = sample.astype(str).values
          logging.info(f"Sample of feature {feature}: {sample}")
          sample_markup = "</br>".join(sample)
          match_with_link = re.match(
              "(<a.+>)f_(.+)_\\w+(<\\/a>)", feature
          )
          match_without_link = re.match("f_(.+)_\\w+", feature)
          if match_with_link is not None:
              renamed_feature = f"{match_with_link.group(1)}{match_with_link.group(2)}{match_with_link.group(3)}"
          elif match_without_link is not None:
              renamed_feature = match_without_link.group(1)
          else:
              renamed_feature = feature
          logging.info(
              f"Sample markup of {renamed_feature}: {sample_markup}"
          )
          return f"<div class='tooltip'>{renamed_feature}<span class='tooltiptext'>{sample_markup}</span></div>"
  
      relevant_fields[field_column_header] = relevant_fields[
          field_column_header
      ].apply(add_hint)
      summary = (
          raw_relevant_fields[
              raw_relevant_fields["Provider"] != "Upgini"
          ]
          .drop(columns="Provider")
          .groupby(by=included_in_data_listings_header)
          .agg(
              shap=pd.NamedAgg(
                  column=shap_column_header, aggfunc="sum"
              ),
              count=pd.NamedAgg(
                  column=shap_column_header, aggfunc="count"
              ),
          )
          # .sum(shap_column_header)
          .sort_values(by="shap", ascending=False)
          .reset_index()
          .rename(
              columns={
                  included_in_data_listings_header: data_listings_header,
                  "shap": all_fields_shap_header,
                  "count": relevant_features_header,
              }
          )
      )
      relevant_fields = relevant_fields.drop(columns="Provider")
  
      def add_button(listing: str) -> str:
          url_anchor = re.match("(<a href=.+>).+</a>", listing)
          if url_anchor is not None:
              btn_html = (
                  f'<div class="stButton">{url_anchor.group(1)}<button kind="secondary"><p>Instant purchase</p>'
                  "</button></a></div>"
              )
              return btn_html
          else:
              return ""
  
      summary[action_header] = summary[data_listings_header].apply(
          add_button
      )
  
      customized_product_title = "Optimized for ML database"
      customized_product_row = pd.DataFrame(
          {
              data_listings_header: [
                  f"<a href='https://ipinfo.io/products/ip-database-download'>{customized_product_title}</a>"
              ],
              all_fields_shap_header: [
                  relevant_fields[shap_column_header].sum()
              ],
              relevant_features_header: [
                  relevant_fields[shap_column_header].count()
              ],
              action_header: [
                  # "<a href='https://upgini.com'><button class='css-1n543e5 bluebutton'>Request a quote</button></a>"
                  # Temporary for IPInfo
                  add_button(
                      f"<a href='https://ipinfo.io/products/ip-database-download'>{customized_product_title}</a>"
                  )
                  # "Request a quote"
              ],
          }
      )
      summary = pd.concat(
          [customized_product_row, summary]
      ).reset_index()
  
      def price_by_listing(listing):
          if customized_product_title in listing:
              return "By request"
          elif (
              "IP Address Data for Mobile Carrier Detection" in listing
          ):
              return "Trial 30 days, $80/month"
          elif "Privacy detection database" in listing:
              return "$1000/one-off"
          elif "IP Geolocation Data" in listing:
              return "No Trial, $800/month"
          else:
              return ""
  
      summary[price_header] = summary[data_listings_header].apply(
          price_by_listing
      )
      summary[relevant_features_header] = summary[
          relevant_features_header
      ].astype(int)
      summary = summary.rename(
          columns={shap_column_header: all_fields_shap_header}
      )
      summary = summary[
          [
              data_listings_header,
              all_fields_shap_header,
              relevant_features_header,
              price_header,
              action_header,
          ]
      ]
  
      relevant_fields = relevant_fields[
          [
              field_column_header,
              shap_column_header,
              included_in_data_listings_header,
          ]
      ]
  
      # Using for email
      raw_relevant_fields = raw_relevant_fields.drop(columns="Provider")
      raw_relevant_fields[
          included_in_data_listings_header
      ] = raw_relevant_fields[included_in_data_listings_header].apply(
          remove_anchor
      )
      raw_relevant_fields[field_column_header] = raw_relevant_fields[
          field_column_header
      ].apply(get_original_name)
  
      return relevant_fields, summary, raw_relevant_fields
  
file_path: upgini/tests/test_widget.py
imports: import logging
  import os
  import re
  from typing import List, Optional, Tuple
  import pandas
  from pandas.api.types import is_float_dtype
  from pandas.testing import assert_frame_equal
  from requests_mock import Mocker
  from tests.utils import mock_default_requests, mock_get_metadata, mock_get_task_metadata_v2, mock_initial_progress, mock_initial_search, mock_initial_summary, mock_raw_features
  from upgini.features_enricher import FeaturesEnricher
  from upgini.metadata import FeaturesMetadataV2, HitRateMetrics, ProviderTaskMetadataV2, RuntimeParameters, SearchKey
label_desc: Use image node_id 1 for calling a global function with example usage: run_search(df, target_column, ip_column, date_column, generate_features, company) and returns: relevant_fields,  summary,  raw_relevant_fields, re, re, str, renamed_feature, str, sample_markup, str, btn_html, str, str, str, str, str, str