code: def device_lock(device_id, timeout=7200):
      return filelock.FileLock(
          "/tmp/device-lock-%s" % device_id.replace("/", ""),
          timeout=timeout,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import inspect
  import hashlib
  import filelock
  import errno
  import os
  import sys
  import shutil
  import traceback
label_desc: Use image node_id 8 for calling a global function with example usage: device_lock(device_id, timeout) and returns: filelock