code: def check_number_of_labels(n_labels, n_samples):
      """Check that number of labels are valid.
  
      Parameters
      ----------
      n_labels : int
          Number of labels.
  
      n_samples : int
          Number of samples.
      """
      if not 1 < n_labels < n_samples:
          raise ValueError(
              "Number of labels is %d. Valid values are 2 to n_samples - 1 (inclusive)"
              % n_labels
          )
  
file_path: catboost/contrib/python/scikit-learn/py3/sklearn/metrics/cluster/_unsupervised.py
imports: import functools
  from numbers import Integral
  import numpy
  from scipy.sparse import issparse
  from ...preprocessing import LabelEncoder
  from ...utils import _safe_indexing, check_random_state, check_X_y
  from ...utils._param_validation import Interval, StrOptions, validate_params
  from ..pairwise import _VALID_METRICS, pairwise_distances, pairwise_distances_chunked
label_desc: Use image node_id 1 for calling a global function with example usage: check_number_of_labels(n_labels, n_samples) without return types