code: def wandb_mock(monkeypatch):
      class RunType:  # to make isinstance checks pass
          pass
  
      run_mock = Mock(
          spec=RunType,
          log=Mock(),
          config=Mock(),
          watch=Mock(),
          log_artifact=Mock(),
          use_artifact=Mock(),
          id="run_id",
      )
  
      wandb = ModuleType("wandb")
      wandb.init = Mock(return_value=run_mock)
      wandb.run = Mock()
      wandb.require = Mock()
      wandb.Api = Mock()
      wandb.Artifact = Mock()
      wandb.Image = Mock()
      wandb.Audio = Mock()
      wandb.Video = Mock()
      wandb.Table = Mock()
      monkeypatch.setitem(sys.modules, "wandb", wandb)
  
      wandb_sdk = ModuleType("sdk")
      monkeypatch.setitem(sys.modules, "wandb.sdk", wandb_sdk)
  
      wandb_sdk_lib = ModuleType("lib")
      wandb_sdk_lib.RunDisabled = RunType
      monkeypatch.setitem(sys.modules, "wandb.sdk.lib", wandb_sdk_lib)
  
      wandb_wandb_run = ModuleType("wandb_run")
      wandb_wandb_run.Run = RunType
      monkeypatch.setitem(
          sys.modules, "wandb.wandb_run", wandb_wandb_run
      )
  
      wandb.sdk = wandb_sdk
      wandb.sdk.lib = wandb_sdk_lib
      wandb.wandb_run = wandb_wandb_run
  
      monkeypatch.setattr(
          "lightning.pytorch.loggers.wandb._WANDB_AVAILABLE", True
      )
      return wandb
  
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 2 for calling a global function with example usage: wandb_mock(monkeypatch) and returns: wandb