import base64


def toProtobufString(protoObject):
    """
    Serialises a protobuf object as a base64-encoded protobuf string
    """
    # the base64-encoding shouldn't be necessary, but otherwise
    # currently the "string" with high-bit-set bytes gets helpfully
    # re-coded into corresponding unicode string in transit.
    # Should find and fix that rather than base64 encoding
    return base64.b64encode(protoObject.SerializeToString())