def new_protocol(self, protocol_name):
if self._protocol_in_progress:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>if protocol_name in self._protocols:<EOL><INDENT>raise Exception('<STR_LIT>' % protocol_name)<EOL><DEDENT>self._init_new_message_stack(Protocol(protocol_name, library=self))<EOL>self._protocol_in_progress = True<EOL>
Start defining a new protocol template.

        All messages sent and received from a connection that uses a protocol
        have to conform to this protocol template.