code: def mock_requeue(
      called_with: tp.Optional[int] = None, not_called: bool = False
  ):
      assert not_called or called_with is not None
      requeue = patch(
          "submitit.slurm.slurm.SlurmJobEnvironment._requeue",
          return_value=None,
      )
      with requeue as _patch:
          try:
              yield
          finally:
              if not_called:
                  _patch.assert_not_called()
              else:
                  _patch.assert_called_with(called_with)
  
imports: import contextlib
  import os
  import signal
  import subprocess
  import typing
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  import submitit
  from ..None import helpers
  from ..core import job_environment, submission, test_core, utils
  from ..core.core import Job
  from .None import slurm
label_desc: Use image node_id 8 for calling a global function with example usage: mock_requeue(called_with, not_called) without return types