def METHOD_NAME(monkeypatch):
    def mock_artifact_fetcher(job_download_func):
        def artifact_fetcher(client, name, type):
            if type == "job":
                job_artifact = mock.MagicMock()
                job_artifact.type = "job"
                job_artifact.download = job_download_func
                job_artifact.digest = "job123"
                return job_artifact
            else:
                code_artifact = mock.MagicMock()
                code_artifact.type = "code"
                code_artifact.download = code_download_func
                code_artifact.digest = "code123"
                return code_artifact
        monkeypatch.setattr(
            wandb.apis.public.Api,
            "artifact",
            lambda *arg, **kwargs: artifact_fetcher(*arg, **kwargs),
        )
        monkeypatch.setattr(
            wandb.sdk.launch._project_spec.wandb.apis.public.Api,
            "artifact",
            lambda *arg, **kwargs: artifact_fetcher(*arg, **kwargs),
        )
    return mock_artifact_fetcher