Implement and test to_ballot_stream() and from_ballot_stream().