code: def get_model_of_pipeline(model: Union[Pipeline, BasicModel]):
      """Return the model of a given Pipeline or itself if a BaseEstimator is given.
  
      Parameters
      ----------
      model : Union[Pipeline, BasicModel]
          a Pipeline or a BasicModel
  
      Returns
      -------
      Union[Pipeline, BasicModel]
          the inner BaseEstimator of the Pipeline or itself
      """
      if isinstance(model, Pipeline):
          # get model type from last step in pipeline
          return model.steps[-1][1]
      return model
  
label_desc: Use image node_id 1 for calling a global function with example usage: get_model_of_pipeline(model) and returns: model, model