code: def test_memoize_not_thread_safe():
      class Counter(object):
          def __init__(self, s):
              self.val = s
  
          def inc(self):
              self.val += 1
              return self.val
  
      @func.memoize(thread_safe=False)
      def io_job(n):
          time.sleep(0.1)
          return Counter(n)
  
      def worker(n):
          assert io_job(n).inc() == n + 1
          assert io_job(n).inc() == n + 2
          assert io_job(n * 10).inc() == n * 10 + 1
          assert io_job(n * 10).inc() == n * 10 + 2
          assert io_job(n).inc() == n + 3
  
      threads = []
      for i in range(5):
          threads.append(threading.Thread(target=worker, args=(i + 1,)))
  
      st = time.time()
  
      for thread in threads:
          thread.start()
      for thread in threads:
          thread.join()
  
      elapsed_time = time.time() - st
      assert elapsed_time < 0.5
  
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 8 for calling a global function with example usage: test_memoize_not_thread_safe() and returns: Counter, self