code: def _get_feature_importances(estimator):
      """Retrieve or aggregate feature importances from estimator"""
      importances = getattr(estimator, "feature_importances_", None)
  
      if importances is None and hasattr(estimator, "coef_"):
          if estimator.coef_.ndim == 1:
              importances = np.abs(estimator.coef_)
  
          else:
              importances = np.sum(np.abs(estimator.coef_), axis=0)
  
      elif importances is None:
          raise ValueError(
              "The underlying estimator %s has no `coef_` or "
              "`feature_importances_` attribute. Either pass a fitted estimator"
              " to SelectFromModel or call fit before calling transform."
              % estimator.__class__.__name__
          )
  
      return importances
  
file_path: catboost/contrib/python/scikit-learn/py2/sklearn/feature_selection/from_model.py
imports: import numpy
  from .base import SelectorMixin
  from ..base import TransformerMixin, BaseEstimator, clone
  from ..externals import six
  from ..utils import safe_mask, check_array, deprecated
  from ..utils.validation import check_is_fitted
  from ..exceptions import NotFittedError
label_desc: Use image node_id 1 for calling a global function with example usage: _get_feature_importances(estimator) and returns: importances