code: def auto_flintmodel(model, task):
      r"""
      Check flint model type and whether compatible to task.
  
      :param textflint.FlintModel|str model: FlintModel instance or
          python file path which contains FlintModel instance
      :param str task: task name
      :return: textflint.FlintModel
  
      """
      if not model:
          return None
  
      assert isinstance(model, (FlintModel, str)), (
          f"Not support {type(model)} "
          f"input, please wrapper your model with FlintModel."
      )
  
      if isinstance(model, str):
          assert os.path.exists(model), f"Cant find model file {model}"
          model = load_module_from_file("model", model)
  
      assert model.task == task, (
          f"The task of your FlintModel is "
          f"{model.task}, not compatible with task {task}"
      )
  
      return model
  
file_path: textflint/textflint/adapter.py
imports: import os
  from .input.config import Config
  from .common import logger
  from .input.dataset import Dataset
  from .input.model import FlintModel
  from .common.utils import task_class_load
  from .common.utils.load import load_module_from_file
  from .generation.generator import Generator, UTGenerator
  from .common.settings import GENERATOR_PATH, NLP_TASK_MAP
  from .report.report_generator import ReportGenerator
label_desc: Use image node_id 4 for calling a global function with example usage: auto_flintmodel(model, task) and returns: model, None