code: def _obtain_lock(self):
          
          starttime = time.time()
          maxtime = starttime + float(self._max_block_time)
          while True:
              try:
                  super(BlockingLockFile, self)._obtain_lock()
              except IOError:
                  # synity check: if the directory leading to the lockfile is not
                  # readable anymore, raise an exception
                  curtime = time.time()
                  if not osp.isdir(osp.dirname(self._lock_file_path())):
                      msg = "Directory containing the lockfile %r was not readable anymore after waiting %g seconds" % (
                          self._lock_file_path(), curtime - starttime)
                      raise IOError(msg)
                  # END handle missing directory
  
                  if curtime >= maxtime:
                      msg = "Waited %g seconds for lock at %r" % (maxtime - starttime, self._lock_file_path())
                      raise IOError(msg)
                  # END abort if we wait too long
                  time.sleep(self._check_interval)
              else:
                  break
docs: This method blocks until it obtained the lock, or raises IOError if
          it ran out of time or if the parent directory was not available anymore.
          If this method returns, you are guaranteed to own the lock