def send_message(self, msg_dict):
with self._writer_lock:<EOL><INDENT>try:<EOL><INDENT>self.output_stream.flush()<EOL>self.output_stream.write(self.serialize_dict(msg_dict))<EOL>self.output_stream.flush()<EOL><DEDENT>except IOError:<EOL><INDENT>raise StormWentAwayError()<EOL><DEDENT>except:<EOL><INDENT>log.exception("<STR_LIT>", msg_dict)<EOL><DEDENT><DEDENT>
Serialize a message dictionary and write it to the output stream.