code: func TemporaryNetworkError(n int) RetryFunc {
  	return func(err error) (retry bool, delay time.Duration) {
  		var nerr net.Error
  		var ok bool
  
  		// Never retry if this is not a network error.
  		switch rerr := err.(type) {
  		case *url.Error:
  			if nerr, ok = rerr.Err.(net.Error); !ok {
  				return false, 0
  			}
  		case net.Error:
  			nerr = rerr
  		default:
  			return false, 0
  		}
  
  		if !nerr.Temporary() {
  			return false, 0
  		}
  
  		// Don't retry if we're out of tries.
  		if n--; n <= 0 {
  			return false, 0
  		}
  
  		return true, 0
  	}
  }
docs: // TemporaryNetworkError returns a RetryFunc that retries up to a maximum of n
  // times, only if the error returned by the RoundTrip function is a temporary
  // network error (for example: a connect timeout).