'Acquire an exclusive lock on the currently-loaded session data.'

def acquire_lock(self, path=None):

    if (path is None):
        path = self._get_file_path()
    path += self.LOCK_SUFFIX
    checker = locking.LockChecker(self.id, self.lock_timeout)
    while (not checker.expired()):
        try:
            self.lock = lockfile.LockFile(path)
        except lockfile.LockError:
            time.sleep(0.1)
        else:
            break
    self.locked = True
    if self.debug:
        cherrypy.log('Lock    acquired.', 'TOOLS.SESSIONS')
