code: def _check_n_features(self, X, reset: bool = False):
      n_features = X.shape[1]
      if reset:
          self.n_features_in_ = n_features
          if hasattr(X, "columns"):
              self.feature_names_in_ = [str(c) for c in X.columns]
      else:
          if not hasattr(self, "n_features_in_"):
              raise RuntimeError(
                  "The reset parameter is False but there is no "
                  "n_features_in_ attribute. Is this estimator fitted?"
              )
          if n_features != self.n_features_in_:
              raise ValueError(
                  "X has {} features, but this {} is expecting {} features "
                  "as input.".format(
                      n_features,
                      self.__class__.__name__,
                      self.n_features_in_,
                  )
              )
  
imports: import warnings
  from typing import List, Optional, TypeVar
  import cuml.internals.logger
  from cudf import DataFrame, Series
  from cuml import Base
  from cuml.common.doc_utils import generate_docstring
  from cuml.common.exceptions import NotFittedError
  from cuml.internals.safe_imports import cpu_only_import, gpu_only_import, gpu_only_import_from
  from cuml.preprocessing import LabelEncoder
label_desc: Use image node_id 1 for calling the CheckFeaturesMixIn obj's underlying member method code with example usage: obj._check_n_features(X, reset) without return types