code: func (s *SwarmingClient) fetch(c context.Context, path, user string) error {
  	botCode := s.server + "/bot_code"
  	logging.Infof(c, "downloading: %s", botCode)
  	rsp, err := s.Get(botCode)
  	if err != nil {
  		return errors.Annotate(err, "failed to fetch bot code").Err()
  	}
  	defer rsp.Body.Close()
  	if rsp.StatusCode != http.StatusOK {
  		return errors.Reason("server returned %q", rsp.Status).Err()
  	}
  
  	logging.Infof(c, "installing: %s", path)
  	// 0644 allows the bot code to be read by all users.
  	// Useful when SSHing to the instance.
  	out, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0644)
  	if err != nil {
  		return errors.Annotate(err, "failed to open: %s", path).Err()
  	}
  	defer out.Close()
  	_, err = io.Copy(out, rsp.Body)
  	if err != nil {
  		return errors.Annotate(err, "failed to write: %s", path).Err()
  	}
  	if err := s.chown(c, path, user); err != nil {
  		return errors.Annotate(err, "failed to chown: %s", path).Err()
  	}
  	return nil
  }
docs: // fetch fetches the Swarming bot code.