code: def finetune(
      self,
      model_name,
      project_name,
      base_model_version: int,
      data_integration_ref=None,
      fetch_data_query=None,
      join_learn_process=False,
      label=None,
      set_active=True,
      args: Optional[dict] = None,
  ):
      # generate new record from latest version as starting point
      project = self.database_controller.get_project(name=project_name)
  
      search_args = {
          "active": None,
          "name": model_name,
          "status": PREDICTOR_STATUS.COMPLETE,
      }
      if base_model_version is not None:
          search_args["version"] = base_model_version
      else:
          search_args["active"] = True
      predictor_records = get_model_records(**search_args)
      if len(predictor_records) == 0:
          raise Exception("Can't find suitable base model")
  
      predictor_records.sort(
          key=lambda x: x.training_stop_at, reverse=True
      )
      predictor_records = [
          x for x in predictor_records if x.training_stop_at is not None
      ]
      base_predictor_record = predictor_records[0]
  
      learn_args = base_predictor_record.learn_args
      learn_args["using"] = (
          args
          if not learn_args.get("using", False)
          else {**learn_args["using"], **args}
      )
  
      if hasattr(self.handler_class, "create_validation"):
          self.handler_class.create_validation(
              base_predictor_record.to_predict,
              args=learn_args,
              handler_storage=HandlerStorage(self.integration_id),
          )
  
      predictor_record = db.Predictor(
          company_id=ctx.company_id,
          name=model_name,
          integration_id=self.integration_id,
          data_integration_ref=data_integration_ref,
          fetch_data_query=fetch_data_query,
          mindsdb_version=mindsdb_version,
          to_predict=base_predictor_record.to_predict,
          learn_args=learn_args,
          data={"name": model_name},
          project_id=project.id,
          training_data_columns_count=None,
          training_data_rows_count=None,
          training_start_at=dt.datetime.now(),
          status=PREDICTOR_STATUS.GENERATING,
          label=label,
          hostname=socket.gethostname(),
          version=(
              db.session.query(
                  coalesce(func.max(db.Predictor.version), 1) + 1
              )
              .filter_by(
                  company_id=ctx.company_id,
                  name=model_name,
                  project_id=project.id,
                  deleted_at=null(),
              )
              .scalar_subquery()
          ),
          active=False,
      )
      db.serializable_insert(predictor_record)
  
      task = self.base_ml_executor.apply_async(
          task_type=ML_TASK_TYPE.FINETUNE,
          model_id=predictor_record.id,
          payload={
              "handler_meta": {
                  "module_path": self.handler_class.__module__,
                  "class_name": self.handler_class.__name__,
                  "engine": self.engine,
                  "integration_id": self.integration_id,
              },
              "context": ctx.dump(),
              "model_id": predictor_record.id,
              "problem_definition": predictor_record.learn_args,
              "set_active": set_active,
              "base_model_id": base_predictor_record.id,
              "data_integration_ref": data_integration_ref,
              "fetch_data_query": fetch_data_query,
              "project_name": project_name,
          },
      )
  
      if join_learn_process is True:
          task.result()
          predictor_record = db.Predictor.query.get(predictor_record.id)
          db.session.refresh(predictor_record)
      else:
          # to prevent memory leak need to add any callback
          task.add_done_callback(empty_callback)
  
      return predictor_record
  
imports: import socket
  import datetime
  from typing import Optional
  import pandas
  from sqlalchemy import func, null
  from sqlalchemy.sql.functions import coalesce
  from mindsdb_sql import parse_sql
  from mindsdb.utilities.config import Config
  import mindsdb.interfaces.storage.db
  from mindsdb.integrations.libs.response import HandlerResponse, RESPONSE_TYPE
  from mindsdb.__about__ import __version__
  from mindsdb.utilities.hooks import after_predict
  from mindsdb.interfaces.model.model_controller import ModelController
  from mindsdb.interfaces.model.functions import get_model_record
  from mindsdb.integrations.libs.const import PREDICTOR_STATUS
  from mindsdb.interfaces.database.database import DatabaseController
  from mindsdb.interfaces.storage.model_fs import ModelStorage, HandlerStorage
  from mindsdb.utilities.context import context
  from mindsdb.interfaces.model.functions import get_model_records
  from mindsdb.utilities.functions import mark_process
  import mindsdb.utilities.profiler
  from mindsdb.utilities.ml_task_queue.producer import MLTaskProducer
  from mindsdb.utilities.ml_task_queue.const import ML_TASK_TYPE
  from mindsdb.integrations.libs.process_cache import process_cache, empty_callback
label_desc: Use image node_id 8 for calling the BaseMLEngineExec obj's underlying member method code with example usage: obj.finetune(model_name, project_name, base_model_version, data_integration_ref, fetch_data_query, join_learn_process, label, set_active, args) and returns: predictor_record