code: def test_with_timeout(tmpfile):
      # Open the file 2 times
      with pytest.raises(portalocker.AlreadyLocked):
          with portalocker.Lock(tmpfile, timeout=0.1) as fh:
              print("writing some stuff to my cache...", file=fh)
              with portalocker.Lock(
                  tmpfile, timeout=0.1, mode="wb", fail_when_locked=True
              ):
                  pass
              print("writing more stuff to my cache...", file=fh)
  
file_path: catboost/contrib/python/portalocker/py2/tests/tests.py
imports: from __future__ import print_function
  from __future__ import with_statement
  import pytest
  import portalocker
label_desc: Use image node_id 2 for calling a global function with example usage: test_with_timeout(tmpfile) without return types