code: def test_redis_lock():
      channel = str(random.random())
  
      lock_a = redis.RedisLock(channel)
      lock_a.acquire(fail_when_locked=True)
      time.sleep(0.01)
  
      lock_b = redis.RedisLock(channel)
      try:
          with pytest.raises(portalocker.AlreadyLocked):
              lock_b.acquire(fail_when_locked=True)
      finally:
          lock_a.release()
          lock_a.connection.close()
  
file_path: catboost/contrib/python/portalocker/py3/tests/test_redis.py
imports: import _thread
  import logging
  import random
  import time
  import pytest
  from redis import client
  from redis import exceptions
  import portalocker
  from portalocker import redis
  from portalocker import utils
label_desc: Use image node_id 2 for calling a global function with example usage: test_redis_lock() without return types