code: def _condition_variants_number(
      result,
      num_max_variants: int,
      max_cols_to_show: int = 5,
      max_forms_to_show: int = 5,
  ):
      not_passing_variants = defaultdict(list)
      for col, baseforms in result["columns"].items():
          for base_form, variants_list in baseforms.items():
              if len(variants_list) > num_max_variants:
                  if len(not_passing_variants[col]) < max_forms_to_show:
                      not_passing_variants[col].append(base_form)
      if not_passing_variants:
          variants_to_show = dict(
              itertools.islice(
                  not_passing_variants.items(), max_cols_to_show
              )
          )
          details = (
              f'Found {len(not_passing_variants)} out of {len(result["columns"])} columns with amount of '
              f"variants above threshold: {variants_to_show}"
          )
          return ConditionResult(ConditionCategory.WARN, details)
  
      return ConditionResult(
          ConditionCategory.PASS,
          get_condition_passed_message(["columns"]),
      )
  
imports: import itertools
  from collections import defaultdict
  from typing import Dict, List, Optional, Union
  import pandas
  from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
  from deepchecks.core.reduce_classes import ReduceFeatureMixin
  from deepchecks.tabular import Context, SingleDatasetCheck
  from deepchecks.tabular._shared_docs import docstrings
  from deepchecks.tabular.utils.feature_importance import N_TOP_MESSAGE, column_importance_sorter_df
  from deepchecks.tabular.utils.messages import get_condition_passed_message
  from deepchecks.utils.dataframes import select_from_dataframe
  from deepchecks.utils.strings import format_percent, get_base_form_to_variants_dict, is_string_column
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 1 for calling a global function with example usage: _condition_variants_number(result, num_max_variants, max_cols_to_show, max_forms_to_show) and returns: ConditionResult, ConditionResult