<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def new_protocol(self, protocol_name):
 """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. """

        if self._protocol_in_progress:
            raise Exception('Can not start a new protocol definition in middle of old.')
        if protocol_name in self._protocols:
            raise Exception('Protocol %s already defined' % protocol_name)
        self._init_new_message_stack(Protocol(protocol_name, library=self))
        self._protocol_in_progress = True