code: def write(self, msg):
          
          ser = msg.SerializeToString()
          header = struct.pack(">HL", mapping.get_type(msg), len(ser))
          self._write(b"##" + header + ser, msg)
docs: Write mesage to tansport.  msg should be a member of a valid `protobuf class <https://developers.google.com/protocol-buffers/docs/pythontutorial>`_ with a SerializeToString() method.