code: def assert_fitted(estimator, attrs=ATTRS, X_test=None):
      """
      Check that the estimator is fitted by ensuring it does have the attributes
      passed in attrs. If X_test is specified, it is passed to predict which
      must not raise a NotFitted exception.
      """
      __traceback_hide__ = True
      for attr in attrs:
          msg = (
              "model is not fitted, does not have {} attribute".format(
                  attr
              )
          )
          assert hasattr(estimator, attr), msg
  
      if X_test is not None:
          try:
              estimator.predict(X_test)
          except (NotFitted, NotFittedError):
              pytest.fail("estimator not fitted raised from predict")
  
file_path: yellowbrick/tests/test_classifier/conftest.py
imports: import pytest
  from tests.fixtures import Dataset, Split
  from yellowbrick.exceptions import NotFitted
  from sklearn.exceptions import NotFittedError
  from sklearn.datasets import make_classification
  from sklearn.model_selection import train_test_split
label_desc: Use image node_id 2 for calling a global function with example usage: assert_fitted(estimator, attrs, X_test) without return types