code: def _validate_size(size, n_samples, param_name):
      if size > n_samples:
          raise ValueError(
              "%s must be no greater than the number of samples (%d). Got %d"
              % (param_name, n_samples, size)
          )
  
imports: import warnings
  from numbers import Integral, Real
  import numpy
  from scipy.sparse import SparseEfficiencyWarning, issparse
  from ..base import BaseEstimator, ClusterMixin, _fit_context
  from ..exceptions import DataConversionWarning
  from ..metrics import pairwise_distances
  from ..metrics.pairwise import _VALID_METRICS, PAIRWISE_BOOLEAN_FUNCTIONS
  from ..neighbors import NearestNeighbors
  from ..utils import gen_batches, get_chunk_n_rows
  from ..utils._param_validation import HasMethods, Interval, RealNotInt, StrOptions, validate_params
  from ..utils.validation import check_memory
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_size(size, n_samples, param_name) without return types