code: def decode(packet):
      
      packet = bytes(packet).strip(END)
      if not is_valid(packet):
          raise ProtocolError(packet)
      return packet.strip(END).replace(ESC + ESC_END, END).replace(ESC + ESC_ESC, ESC)
docs: decode(packet) -> message from SLIP-encoded packet
  
      Retrieves the message from the SLIP-encoded packet.
  
      :param bytes packet: The SLIP-encoded message.
             Note that this must be exactly one complete packet.
             The :func:`decode` function does not provide any buffering
             for incomplete packages, nor does it provide support
             for decoding data with multiple packets.
      :return: The decoded message
      :rtype: bytes
      :raises ProtocolError: if the packet contains an invalid byte sequence.