code: def assert_valid_estimator(instance):
      """Assert that an instance has a ``get_params`` and ``fit`` method."""
      has_get_params = hasattr(instance, "get_params")
      has_fit = hasattr(instance, "fit")
  
      if not has_get_params:
          raise TypeError(
              "'%s' does not appear to be a valid"
              " estimator as it does not implement a "
              "'get_params' method. Type: "
              "%s" % (instance, type(instance))
          )
  
      if not has_fit:
          raise TypeError(
              "'%s' does not appear to be a valid"
              " estimator as it does not implement a "
              "'fit' method. Type: "
              "%s" % (instance, type(instance))
          )
  
      try:
          instance.get_params()
      except TypeError:
          raise TypeError(
              "'%s' does not appear to be an instance of an "
              "estimator class, but the class itself." % instance
          )
  
imports: import warnings
  from .exceptions import NotFittedError, LayerSpecificationWarning, LayerSpecificationError, ParallelProcessingError, ParallelProcessingWarning
label_desc: Use image node_id 3 for calling a global function with example usage: assert_valid_estimator(instance) without return types