code: def test_threadlocal_io_scopes():
      """This tests that scopes are thread local and they don't clobber each other when different threads are competing"""
  
      def _return_io_scope(io_scope_path):
          with io_scope(io_scope_path):
              time.sleep(np.random.uniform(0.05, 0.1))
              return current_io_scopes()[-1]
  
      n_tasks = 16
      n_workers = 8
      with ThreadPoolExecutor(max_workers=n_workers) as executor:
          futures = {
              executor.submit(
                  _return_io_scope, f"gs://test-{i}"
              ): f"gs://test-{i}"
              for i in range(n_tasks)
          }
          results = [f.result() for f in futures]
          assert results == list(futures.values())
  
imports: import time
  import pytest
  import numpy
  from lucid.misc.io.saving import save, CaptureSaveContext, batch_save
  from lucid.misc.io.loading import load
  from lucid.misc.io.scoping import io_scope, current_io_scopes
  from concurrent.futures import ThreadPoolExecutor
  import os.path
  import io
  import tensorflow
label_desc: Use image node_id 18 for calling a global function with example usage: test_threadlocal_io_scopes() and returns: current_io_scopes