code: def test_gil_contention():
      pytest.importorskip("gilknocker")
  
      # Default enabled if gilknocker installed
      sm = SystemMonitor()
      a = sm.update()
      assert "gil_contention" in a
  
      assert sm._gilknocker.is_running
      sm.close()
      sm.close()  # Idempotent
      assert not sm._gilknocker.is_running
  
      sm = SystemMonitor(monitor_gil_contention=False)
      a = sm.update()
      assert "gil_contention" not in a
  
      assert dask.config.get(
          "distributed.admin.system-monitor.gil.enabled"
      )
      with dask.config.set(
          {"distributed.admin.system-monitor.gil.enabled": False}
      ):
          sm = SystemMonitor()
          a = sm.update()
          assert "gil_contention" not in a
  
file_path: distributed/distributed/tests/test_system_monitor.py
imports: from __future__ import annotations
  from time import sleep
  import pytest
  import dask
  from distributed.system_monitor import SystemMonitor
label_desc: Use image node_id 7 for calling a global function with example usage: test_gil_contention() without return types