code: func withRetry(c context.Context, call func() error) error {
  	return retry.Retry(c, transient.Only(retry.Default), func() error {
  		err := call()
  		if err == nil {
  			return nil
  		}
  		apiErr, _ := err.(*googleapi.Error)
  		if apiErr == nil {
  			// RestartUploadError errors are fatal and should be passed unannotated.
  			if _, ok := err.(*RestartUploadError); ok {
  				return err
  			}
  			return errors.Annotate(err, "failed to call GS").Tag(transient.Tag).Err()
  		}
  		ann := errors.Annotate(err, "GS replied with HTTP code %d", apiErr.Code).
  			InternalReason("full response body:\n%s", apiErr.Body).
  			Tag(StatusCodeTag(apiErr.Code))
  		// Retry only on 429 and 5xx responses, according to
  		// https://cloud.google.com/storage/docs/exponential-backoff.
  		if apiErr.Code == 429 || apiErr.Code >= 500 {
  			ann.Tag(transient.Tag)
  		}
  		return ann.Err()
  	}, func(err error, d time.Duration) {
  		logging.WithError(err).Errorf(c, "Transient error when accessing GS. Retrying in %s...", d)
  	})
  }
docs: // withRetry executes a Google Storage API call, retrying on transient errors.
  //
  // If request reached GS, but the service replied with an error, the
  // corresponding HTTP status code can be extracted from the error via
  // StatusCode(err). The error is also tagged as transient based on the code:
  // response with HTTP statuses >=500 and 429 are considered transient errors.
  //
  // If the request never reached GS, StatusCode(err) would return 0 and the error
  // will be tagged as transient.