def attempt_acquire(self, timeout, cursor, end_time, wait):
        if self.is_locked():
            if self.i_am_the_only_lock(cursor):
                return
        else:
            if self.create_lock(cursor):
                return

        # Maybe we should wait a bit longer.
        if timeout is not None and time.time() > end_time:
            if timeout > 0:
                # No more waiting.
                raise LockTimeout
            else:
                # Someone else has the lock and we are impatient..
                raise AlreadyLocked

        # Well, okay.  We"ll give it a bit longer.
        time.sleep(wait)
dataset/ETHPy150Open haystack/eyebrowse-server/notifications/lockfile.py/SQLiteFileLock.attempt_acquire/original