def acquire(self, timeout=None):
        # Hopefully unnecessary for symlink.
        #try:
        #    open(self.unique_name, "wb").close()
        #except IOError:
        #    raise LockFailed("failed to create %s" % self.unique_name)
        timeout = timeout is not None and timeout or self.timeout
        end_time = time.time()
        if timeout is not None and timeout > 0:
            end_time += timeout

        while True:
            # Try and create a symbolic link to it.
            try:
                os.symlink(self.unique_name, self.lock_file)
            except OSError:
                # Link creation failed.  Maybe we've double-locked?
                if self.i_am_locking():
                    # Linked to out unique name. Proceed.
                    return
                else:
                    # Otherwise the lock creation failed.
                    if timeout is not None and time.time() > end_time:
                        if 0 > timeout:
                            raise LockTimeout("Timeout waiting to acquire"
                                              " lock for %s" %
                                              self.path)
                        else:
                            raise AlreadyLocked("%s is already locked" %
                                                self.path)
                    time.sleep(timeout/10 if timeout is not None else 0.1)
            else:
                # Link creation succeeded.  We're good to go.
                return
dataset/ETHPy150Open anzev/hedwig/build/pip/pip/_vendor/lockfile/symlinklockfile.py/SymlinkLockFile.acquire/swapped operands of `>`