code: def _calculate_max_features(self, n_features) -> int:
      if self.max_features == self._FEATURES_RANDOM:
          # Generate a random integer
          return self._rng.randint(2, n_features)
      else:
          if self.max_features == self._FEATURES_SQRT:
              max_feat = round(math.sqrt(n_features))
          elif self.max_features == self._FEATURES_LOG2:
              max_feat = round(math.log2(n_features))
          elif isinstance(self.max_features, int):
              max_feat = n_features
          elif isinstance(self.max_features, float):
              # Consider 'max_features' as a percentage
              max_feat = int(self.max_features * n_features)
          elif self.max_features is None:
              max_feat = n_features
          else:
              raise AttributeError(
                  f"Invalid max_features: {self.max_features}.\n"
                  f"Valid options are: int [2, M], float (0., 1.],"
                  f" {self._FEATURES_SQRT}, {self._FEATURES_LOG2}"
              )
  
          # Sanity checks
          # max_feat is negative, use max_feat + n
          if max_feat < 0:
              max_feat += n_features
          # max_feat <= 0
          # (m can be negative if max_feat is negative and abs(max_feat) > n),
          # use max_features = 1
          if max_feat <= 0:
              max_feat = 1
          # max_feat > n, then use n
          if max_feat > n_features:
              max_feat = n_features
  
          return max_feat
  
imports: from __future__ import annotations
  import abc
  import collections
  import math
  import random
  import sys
  from river import base, drift, metrics, tree, utils
  from river.tree.nodes.et_nodes import ETLeafAdaptive, ETLeafMean, ETLeafModel
  from river.tree.splitter.random_splitter import RegRandomSplitter
label_desc: Use image node_id 5 for calling the ExtraTrees obj's underlying member method code with example usage: obj._calculate_max_features(n_features) and returns: self, max_feat