code: def convert_sklearn_to_river(
      estimator: sklearn_base.BaseEstimator, classes: list | None = None
  ):
      """Wraps a scikit-learn estimator to make it compatible with river.
  
      Parameters
      ----------
      estimator
      classes
          Class names necessary for classifiers.
  
      """
  
      if not hasattr(estimator, "partial_fit"):
          raise ValueError(
              f"{estimator} does not have a partial_fit method"
          )
  
      if (
          isinstance(estimator, sklearn_base.ClassifierMixin)
          and classes is None
      ):
          raise ValueError(
              "classes must be provided to convert a classifier"
          )
  
      wrappers = [
          (sklearn_base.RegressorMixin, SKL2RiverRegressor),
          (
              sklearn_base.ClassifierMixin,
              functools.partial(SKL2RiverClassifier, classes=classes),
          ),
      ]
  
      for base_type, wrapper in wrappers:
          if isinstance(estimator, base_type):
              return wrapper(copy.deepcopy(estimator))  # type: ignore
  
      raise ValueError("Couldn't find an appropriate wrapper")
  
imports: from __future__ import annotations
  import copy
  import functools
  import pandas
  from sklearn import base
  from sklearn import exceptions
  from river import base
label_desc: Use image node_id 1 for calling a global function with example usage: convert_sklearn_to_river(estimator, classes) and returns: wrapper