code: def test_exlusive(tmpfile):
      with open(tmpfile, "w") as fh:
          fh.write("spam and eggs")
  
      fh = open(tmpfile, "r")
      portalocker.lock(fh, portalocker.LOCK_EX | portalocker.LOCK_NB)
  
      # Make sure we can't read the locked file
      with pytest.raises(portalocker.LockException):
          with open(tmpfile, "r") as fh2:
              portalocker.lock(
                  fh2, portalocker.LOCK_EX | portalocker.LOCK_NB
              )
              fh2.read()
  
      # Make sure we can't write the locked file
      with pytest.raises(portalocker.LockException):
          with open(tmpfile, "w+") as fh2:
              portalocker.lock(
                  fh2, portalocker.LOCK_EX | portalocker.LOCK_NB
              )
              fh2.write("surprise and fear")
  
      # Make sure we can explicitly unlock the file
      portalocker.unlock(fh)
      fh.close()
  
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 13 for calling a global function with example usage: test_exlusive(tmpfile) without return types