code: def comet_mock(monkeypatch):
      comet = ModuleType("comet_ml")
      monkeypatch.setitem(sys.modules, "comet_ml", comet)
  
      comet.Experiment = Mock()
      comet.ExistingExperiment = Mock()
      comet.OfflineExperiment = Mock()
      comet.API = Mock()
      comet.config = Mock()
  
      comet_api = ModuleType("api")
      comet_api.API = Mock()
      monkeypatch.setitem(sys.modules, "comet_ml.api", comet_api)
  
      comet.api = comet_api
  
      monkeypatch.setattr(
          "lightning.pytorch.loggers.comet._COMET_AVAILABLE", True
      )
      return comet
  
file_path: pytorch-lightning/tests/tests_pytorch/loggers/conftest.py
imports: import sys
  from types import ModuleType
  from unittest.mock import MagicMock, Mock
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: comet_mock(monkeypatch) and returns: comet