code: def test_memoize_not_thread_safe_stress():
      @func.memoize(thread_safe=False)
      def job():
          for _ in range(1000):
              hash = random.getrandbits(128)
          return hash
  
      def worker(n):
          hash = job()
          results[n] = hash
  
      num_threads = min(multiprocessing.cpu_count() * 4, 64)
      threads = []
      results = [None for _ in range(num_threads)]
  
      for i in range(num_threads):
          thread = threading.Thread(target=worker, args=(i,))
          threads.append(thread)
  
      for thread in threads:
          thread.start()
      for thread in threads:
          thread.join()
      assert len(set(results)) == 1
  
file_path: catboost/library/python/func/ut/test_func.py
imports: import pytest
  import multiprocessing
  import random
  import threading
  import time
  import library.python.func
label_desc: Use image node_id 10 for calling a global function with example usage: test_memoize_not_thread_safe_stress() and returns: hash