code: def mock_train_regressor(monkeypatch, assert_model=None):
      """Mock the train_regressor to return the mocked regressor instead"""
  
      def train_regressor(model, data, **kwargs):
          """Return the mocked model, and then model argument if requested"""
          if assert_model:
              assert model == assert_model
          return mock_model()
  
      monkeypatch.setattr(
          "orion.analysis.partial_dependency_utils.train_regressor",
          train_regressor,
      )
  
imports: import copy
  import numpy
  import pandas
  import pytest
  from orion.analysis.partial_dependency_utils import make_grid, partial_dependency, partial_dependency_grid, reverse
  from orion.core.io.space_builder import SpaceBuilder
  from orion.core.utils import format_trials
  from orion.core.worker.transformer import build_required_space
label_desc: Use image node_id 5 for calling a global function with example usage: mock_train_regressor(monkeypatch, assert_model) and returns: mock_model