code: def cacheLock(self):
          
          cacheLockFile = open(self.cacheLockFile, 'w')
          try:
              flock(cacheLockFile, LOCK_EX)
              logger.debug("CACHE: Obtained lock on file %s" % self.cacheLockFile)
              yield cacheLockFile
          except IOError:
              logger.critical('CACHE: Unable to acquire lock on %s' % self.cacheLockFile)
              raise
          finally:
              cacheLockFile.close()
              logger.debug("CACHE: Released lock")
docs: This is a context manager to acquire a lock on the Lock file that will be used to
          prevent synchronous cache operations between workers.
          :yields: File descriptor for cache lock file in w mode