'Acquire a lock on the backing file.'

def _lock_backing_file(self):

    if self._backing_file:
        self._backing_file_lock = open(self._backing_file, 'a')
        fcntl.flock(self._backing_file_lock, fcntl.LOCK_EX)
