code: def _check_n_components(n_features, n_components):
      """Checks that n_components is less than n_features and deal with the None
      case"""
      if n_components is None:
          return n_features
      if 0 < n_components <= n_features:
          return n_components
      raise ValueError(
          "Invalid n_components, must be in [1, %d]" % n_features
      )
  
imports: import numpy
  from numpy.linalg import LinAlgError
  from sklearn.datasets import make_spd_matrix
  from sklearn.decomposition import PCA
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_X_y, check_random_state
  from .exceptions import PreprocessorError, NonPSDError
  from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
  from scipy.linalg import pinvh, eigh
  import sys
  import time
  import warnings
label_desc: Use image node_id 18 for calling a global function with example usage: _check_n_components(n_features, n_components) and returns: n_features, n_components