docs: static byte[] serializeBinary(TagContext tags) throws TagContextSerializationException {
      // Use a ByteArrayDataOutput to avoid needing to handle IOExceptions.
      final ByteArrayDataOutput byteArrayDataOutput = ByteStreams.newDataOutput();
      byteArrayDataOutput.write(VERSION_ID);
      int totalChars = 0; // Here chars are equivalent to bytes, since we're using ascii chars.
      for (Iterator<Tag> i = InternalUtils.getTags(tags); i.hasNext(); ) {
        Tag tag = i.next();
        if (TagTtl.NO_PROPAGATION.equals(tag.getTagMetadata().getTagTtl())) {
          continue;
        }
        totalChars += tag.getKey().getName().length();
        totalChars += tag.getValue().asString().length();
        encodeTag(tag, byteArrayDataOutput);
      }
      if (totalChars > TAGCONTEXT_SERIALIZED_SIZE_LIMIT) {
        throw new TagContextSerializationException(
            "Size of TagContext exceeds the maximum serialized size "
                + TAGCONTEXT_SERIALIZED_SIZE_LIMIT);
      }
      return byteArrayDataOutput.toByteArray();
    }