code: public static <M extends net.morimekta.providence.PMessage<M, F>, F extends net.morimekta.providence.descriptor.PField>
      Any wrapMessage(@javax.annotation.Nonnull M message, @javax.annotation.Nonnull net.morimekta.providence.serializer.Serializer serializer) {
          try {
              _Builder builder = builder();
              java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
              serializer.serialize(baos, message);
              if (serializer.binaryProtocol()) {
                  builder.setData(net.morimekta.util.Binary.wrap(baos.toByteArray()));
              } else {
                  builder.setText(new String(baos.toByteArray(), java.nio.charset.StandardCharsets.UTF_8));
              }
              builder.setType(message.descriptor().getQualifiedName());
              builder.setMediaType(serializer.mediaType());
              return builder.build();
          } catch (java.io.IOException e) {
              throw new java.io.UncheckedIOException(e.getMessage(), e);
          }
      }
docs: Wrap a message into an <code>Any</code> wrapper message. This
  will serialize the message using the provided serializer.
  
  @param message Wrap this message.
  @param serializer Use this serializer.
  @param <M> The message type
  @param <F> The message field type
  @return The wrapped message.