code: def extract_relevant(model: base.Estimator):
      """Extracts the relevant part of a model.
  
      Parameters
      ----------
      model
  
      """
  
      if ischildobject(obj=model, class_name="Pipeline"):
          return extract_relevant(model._last_step)  # type: ignore[attr-defined]
      return model
  
file_path: river/river/utils/inspect.py
imports: from __future__ import annotations
  import inspect
  from river import base
label_desc: Use image node_id 1 for calling a global function with example usage: extract_relevant(model) and returns: model, extract_relevant