code: def drift_condition(
      max_allowed_categorical_score: float,
      max_allowed_numeric_score: float,
      subject_single: str,
      subject_multi: str,
      allowed_num_subjects_exceeding_threshold: int = 0,
  ):
      """Create a condition function to be used in drift check's conditions.
  
      Parameters
      ----------
      max_allowed_categorical_score: float
          Max value allowed for categorical drift
      max_allowed_numeric_score: float
          Max value allowed for numerical drift
      subject_single: str
          String that represents the subject being tested as single (feature, column, property)
      subject_multi: str
          String that represents the subject being tested as multiple (features, columns, properties)
      allowed_num_subjects_exceeding_threshold: int, default: 0
          Determines the number of properties with drift score above threshold needed to fail the condition.
      """
  
      def condition(result: dict):
          cat_method, num_method = get_drift_method(result)
          cat_drift_props = {
              prop: d["Drift score"]
              for prop, d in result.items()
              if d["Method"] in SUPPORTED_CATEGORICAL_METHODS
          }
          not_passing_categorical_props = {
              props: format_number(d)
              for props, d in cat_drift_props.items()
              if d >= max_allowed_categorical_score
          }
          num_drift_props = {
              prop: d["Drift score"]
              for prop, d in result.items()
              if d["Method"] in SUPPORTED_NUMERIC_METHODS
          }
          not_passing_numeric_props = {
              prop: format_number(d)
              for prop, d in num_drift_props.items()
              if d >= max_allowed_numeric_score
          }
  
          num_failed = len(not_passing_categorical_props) + len(
              not_passing_numeric_props
          )
          if num_failed > allowed_num_subjects_exceeding_threshold:
              details = f"Failed for {num_failed} out of {len(result)} {subject_multi}."
              if not_passing_categorical_props:
                  details += (
                      f"\nFound {len(not_passing_categorical_props)} categorical {subject_multi} with "
                      f"{cat_method} above threshold: {not_passing_categorical_props}"
                  )
              if not_passing_numeric_props:
                  details += (
                      f"\nFound {len(not_passing_numeric_props)} numeric {subject_multi} with {num_method} above"
                      f" threshold: {not_passing_numeric_props}"
                  )
              return ConditionResult(ConditionCategory.FAIL, details)
          else:
              details = f"Passed for {len(result) - num_failed} {subject_multi} out of {len(result)} {subject_multi}."
              if cat_drift_props:
                  prop, score = get_dict_entry_by_value(cat_drift_props)
                  details += (
                      f'\nFound {subject_single} "{prop}" has the highest categorical drift score: '
                      f"{format_number(score)}"
                  )
              if num_drift_props:
                  prop, score = get_dict_entry_by_value(num_drift_props)
                  details += (
                      f'\nFound {subject_single} "{prop}" has the highest numerical drift score: '
                      f"{format_number(score)}"
                  )
              return ConditionResult(ConditionCategory.PASS, details)
  
      return condition
  
imports: from numbers import Number
  from typing import Dict, Optional, Tuple, Union
  import numpy
  import pandas
  from plotly.graph_objs import Figure
  from plotly.subplots import make_subplots
  from scipy.stats import chi2_contingency, wasserstein_distance
  from deepchecks.core import ConditionCategory, ConditionResult
  from deepchecks.core.errors import DeepchecksValueError, NotEnoughSamplesError
  from deepchecks.utils.dict_funcs import get_dict_entry_by_value
  from deepchecks.utils.distribution.plot import CategoriesSortingKind, drift_score_bar_traces, feature_distribution_traces
  from deepchecks.utils.distribution.preprocessing import preprocess_2_cat_cols_to_same_bins
  from deepchecks.utils.plot import DEFAULT_DATASET_NAMES
  from deepchecks.utils.strings import format_number
label_desc: Use image node_id 11 for calling a global function with example usage: drift_condition(max_allowed_categorical_score, max_allowed_numeric_score, subject_single, subject_multi, allowed_num_subjects_exceeding_threshold) and returns: condition, ConditionResult, ConditionResult