code: func (l *Lock) Unlock() error {
  	// Hold the lock as we try to release
  	l.l.Lock()
  	defer l.l.Unlock()
  
  	// Ensure the lock is actually held
  	if !l.isHeld {
  		return ErrLockNotHeld
  	}
  
  	// Set that we no longer own the lock
  	l.isHeld = false
  
  	// Stop the session renew
  	if l.sessionRenew != nil {
  		defer func() {
  			close(l.sessionRenew)
  			l.sessionRenew = nil
  		}()
  	}
  
  	// Get the lock entry, and clear the lock session
  	lockEnt := l.lockEntry(l.lockSession)
  	l.lockSession = ""
  
  	// Release the lock explicitly
  	kv := l.c.KV()
  	_, _, err := kv.Release(lockEnt, nil)
  	if err != nil {
  		return fmt.Errorf("failed to release lock: %v", err)
  	}
  	return nil
  }
docs: // Unlock released the lock. It is an error to call this
  // if the lock is not currently held.