code: def convert_river_to_sklearn(estimator: base.Estimator):
      """Wraps a river estimator to make it compatible with scikit-learn.
  
      Parameters
      ----------
      estimator
  
      """
  
      if isinstance(estimator, compose.Pipeline):
          return pipeline.Pipeline(
              [
                  (name, convert_river_to_sklearn(step))
                  for name, step in estimator.steps.items()
              ]
          )
  
      wrappers = [
          (base.Classifier, River2SKLClassifier),
          (base.Clusterer, River2SKLClusterer),
          (base.Regressor, River2SKLRegressor),
          (base.Transformer, River2SKLTransformer),
      ]
  
      for base_type, wrapper in wrappers:
          if isinstance(estimator, base_type):
              obj = wrapper(estimator)
              obj.instance_ = copy.deepcopy(estimator)
              return obj
  
      raise ValueError("Couldn't find an appropriate wrapper")
  
imports: from __future__ import annotations
  import copy
  import typing
  import numpy
  from sklearn import base
  from sklearn import pipeline, preprocessing, utils
  from river import base, compose, stream
label_desc: Use image node_id 1 for calling a global function with example usage: convert_river_to_sklearn(estimator) and returns: pipeline, obj