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)
  
imports: from __future__ import print_function
  from __future__ import with_statement
  import os
  import dataclasses
  import multiprocessing
  import time
  import typing
  import pytest
  import portalocker
  from portalocker import utils
  from portalocker import LockFlags
label_desc: Use image node_id 3 for calling a global function with example usage: test_with_timeout(tmpfile) without return types