code: def neptune_mock(monkeypatch):
      class RunType:  # to make isinstance checks pass
          def get_root_object(self):
              pass
  
          def __getitem__(self, item):
              pass
  
          def __setitem__(self, key, value):
              pass
  
      run_mock = MagicMock(
          spec=RunType,
          exists=Mock(return_value=False),
          wait=Mock(),
          get_structure=MagicMock(),
      )
      run_mock.get_root_object.return_value = run_mock
  
      neptune = ModuleType("neptune")
      neptune.init_run = Mock(return_value=run_mock)
      neptune.Run = RunType
      monkeypatch.setitem(sys.modules, "neptune", neptune)
  
      neptune_handler = ModuleType("handler")
      neptune_handler.Handler = RunType
      monkeypatch.setitem(
          sys.modules, "neptune.handler", neptune_handler
      )
  
      neptune_types = ModuleType("types")
      neptune_types.File = Mock()
      monkeypatch.setitem(sys.modules, "neptune.types", neptune_types)
  
      neptune_utils = ModuleType("utils")
      neptune_utils.stringify_unsupported = Mock()
      monkeypatch.setitem(sys.modules, "neptune.utils", neptune_utils)
  
      neptune.handler = neptune_handler
      neptune.types = neptune_types
      neptune.utils = neptune_utils
  
      monkeypatch.setattr(
          "lightning.pytorch.loggers.neptune._NEPTUNE_AVAILABLE", True
      )
      return neptune
  
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 4 for calling a global function with example usage: neptune_mock(monkeypatch) and returns: neptune