code: func fetchAnnotationProto(c context.Context, addr *types.StreamAddr) (*miloProto.Step, error) {
  	// The implementation avoids using existing Milo code because the latter is
  	// likely to change and because it does things that we don't need here e.g.
  	// caching that wouldn't apply anyway, etc.
  	// Instead we use LogDog client directly, and thus make it simpler to
  	// reason what this function actually does.
  	// This is not performance critical code.
  
  	// Create a LogDog client.
  	transport, err := auth.GetRPCTransport(c, auth.AsUser)
  	if err != nil {
  		return nil, errors.New("failed to get transport for LogDog server")
  	}
  	client := coordinator.NewClient(&prpc.Client{
  		C:    &http.Client{Transport: transport},
  		Host: addr.Host,
  	})
  
  	// Load the last datagram.
  	var state coordinator.LogStream
  	logEntry, err := client.Stream(addr.Project, addr.Path).
  		Tail(c, coordinator.WithState(&state), coordinator.Complete())
  	switch {
  	case err == coordinator.ErrNoSuchStream:
  		return nil, errAnnotationNotFound
  	case err == coordinator.ErrNoAccess:
  		// Tag with Milo internal tags.
  		return nil, errors.Annotate(err, "getting logdog stream").Tag(grpcutil.PermissionDeniedTag).Err()
  	case err != nil:
  		return nil, err
  	case state.Desc.StreamType != logpb.StreamType_DATAGRAM:
  		return nil, errors.New("not a datagram stream")
  	case logEntry == nil:
  		return nil, errAnnotationNotFound
  	}
  
  	// Decode the datagram as an annotation proto.
  	var res miloProto.Step
  	if err := proto.Unmarshal(logEntry.GetDatagram().Data, &res); err != nil {
  		return nil, err
  	}
  	return &res, nil
  }
docs: // fetchAnnotationProto fetches an annotation proto from LogDog.
  // If the stream is not found, returns errAnnotationNotFound.