@classmethod<EOL><INDENT>def parse(cls, message, default_endianness=DEFAULT_ENDIANNESS):<DEDENT>
obj = cls()<EOL>offset = <NUM_LIT:0><EOL>if hasattr(cls, '<STR_LIT>'):<EOL><INDENT>default_endianness = cls._Meta.get('<STR_LIT>', default_endianness)<EOL><DEDENT>for k, v in iteritems(cls._type_mapping):<EOL><INDENT>try:<EOL><INDENT>value, length = v.buffer_to_value(obj, message, offset, default_endianness=default_endianness)<EOL><DEDENT>except Exception:<EOL><INDENT>logger.warning("<STR_LIT>".format(cls.__name__, k))<EOL>raise<EOL><DEDENT>offset += length<EOL>setattr(obj, k, value)<EOL><DEDENT>return obj, offset<EOL>
Parses a message without any framing, returning the decoded result and length of message consumed. The result
will always be of the same class as :meth:`parse` was called on. If the message is invalid,
:exc:`.PacketDecodeError` will be raised.

:param message: The message to decode.
:type message: bytes
:param default_endianness: The default endianness, unless overridden by the fields or class metadata.
                           Should usually be left at ``None``. Otherwise, use ``'<'`` for little endian and
                           ``'>'`` for big endian.
:return: ``(decoded_message, decoded length)``
:rtype: (:class:`PebblePacket`, :any:`int`)