code: def auto_config(task="UT", config=None):
      r"""
      Check config input or create config automatically.
  
      :param str task: task name
      :param str|dict|textflint.config.Config config: config to control
          generation procedure.
      :return: textflint.config.Config instance.
  
      """
  
      if config is None:
          config_obj = Config(task=task)
      elif isinstance(config, dict):
          config_obj = Config(**config)
      elif isinstance(config, str):
          assert os.path.exists(
              config
          ), f"Cant load config from {config}"
          config_obj = Config().from_json_file(config)
      elif isinstance(config, Config):
          config_obj = config
      else:
          raise ValueError(
              "Invalid config type {0}!".format(type(config))
          )
  
      return config_obj
  
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 1 for calling a global function with example usage: auto_config(task, config) and returns: config_obj