code: func (ks *KeyStore) TimedUnlock(a accounts.Account, passphrase string, timeout time.Duration) error {
  	a, key, err := ks.getDecryptedKey(a, passphrase)
  	if err != nil {
  		return err
  	}
  
  	ks.mu.Lock()
  	defer ks.mu.Unlock()
  	u, found := ks.unlocked[a.Address]
  	if found {
  		if u.abort == nil {
  			// The address was unlocked indefinitely, so unlocking
  			// it with a timeout would be confusing.
  			zeroKey(key.PrivateKey)
  			return nil
  		}
  		// Terminate the expire goroutine and replace it below.
  		close(u.abort)
  	}
  	if timeout > 0 {
  		u = &unlocked{Key: key, abort: make(chan struct{})}
  		go ks.expire(a.Address, u, timeout)
  	} else {
  		u = &unlocked{Key: key}
  	}
  	ks.unlocked[a.Address] = u
  	return nil
  }
docs: // TimedUnlock unlocks the given account with the passphrase. The account
  // stays unlocked for the duration of timeout. A timeout of 0 unlocks the account
  // until the program exits. The account must match a unique key file.
  //
  // If the account address is already unlocked for a duration, TimedUnlock extends or
  // shortens the active unlock timeout. If the address was previously unlocked
  // indefinitely the timeout is not altered.