def test_cannotLockLocked(self):
        """
        If a lock is currently locked, it cannot be locked again.
        """
        lockf = self.mktemp()
        firstLock = lockfile.FilesystemLock(lockf)
        self.assertTrue(firstLock.lock())

        secondLock = lockfile.FilesystemLock(lockf)
        self.assertFalse(secondLock.lock())
        self.assertFalse(secondLock.locked)

        If a lock is currently locked, it cannot be locked again.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_lockfile.py