code: func (p *simpleResourcePool) getIdleHandle() ManagedHandle {
  	var toClose []*idleHandle
  	defer func() {
  		// NOTE: Must keep the closure around to late bind the toClose slice.
  		p.closeHandles(toClose)
  	}()
  
  	now := p.options.getCurrentTime()
  
  	p.mutex.Lock()
  	defer p.mutex.Unlock()
  
  	var i int
  	for i = 0; i < len(p.idleHandles); i++ {
  		idle := p.idleHandles[i]
  		if idle.keepUntil == nil || now.Before(*idle.keepUntil) {
  			break
  		}
  	}
  	if i > 0 {
  		toClose = p.idleHandles[0:i]
  	}
  
  	if i < len(p.idleHandles) {
  		idle := p.idleHandles[i]
  		p.idleHandles = p.idleHandles[i+1:]
  		return NewManagedHandle(p.location, idle.handle, p, p.options)
  	}
  
  	if len(p.idleHandles) > 0 {
  		p.idleHandles = []*idleHandle{}
  	}
  	return nil
  }
docs: // This returns an idle resource, if there is one.