code: def _create_comet_experiment(
      config: dict = None, save: bool = False
  ) -> Union[Experiment, utils.DummyExperiment]:
      """
      Creates a comet_ml.Experiment object, or a dummy replacement object.
  
      If traintool.connect_comet was not called, this returns a dummy object instead,
      which offers the same methods as comet_ml.Experiment, but does nothing. This
      function should be called right before the experiment starts because comet_ml
      prints some logs.
      """
      if "api_key" in comet_config:
          experiment = Experiment(
              api_key=comet_config["api_key"],
              project_name=comet_config["project_name"],
              disabled=save,  # does not write to server if save is False
              display_summary_level=0,
          )
          experiment.log_parameters(config)
      else:
          experiment = utils.DummyExperiment()
      return experiment
  
imports: from comet_ml import Experiment
  from typing import Union, Type
  from pathlib import Path
  import yaml
  from tensorboardX import SummaryWriter
  import tempfile
  import editdistance
  import numpy
  from datetime import datetime
  from loguru import logger
  import sys
  from .None import utils
  from .None import image_classification
  from .model_wrapper import ModelWrapper
label_desc: Use image node_id 4 for calling a global function with example usage: _create_comet_experiment(config, save) and returns: experiment