def serialise(self, default_endianness=None):
<EOL>endianness = (default_endianness or DEFAULT_ENDIANNESS)<EOL>if hasattr(self, '<STR_LIT>'):<EOL><INDENT>endianness = self._Meta.get('<STR_LIT>', endianness)<EOL><DEDENT>inferred_fields = set()<EOL>for k, v in iteritems(self._type_mapping):<EOL><INDENT>inferred_fields |= {x._name for x in v.dependent_fields()}<EOL><DEDENT>for field in inferred_fields:<EOL><INDENT>setattr(self, field, None)<EOL><DEDENT>for k, v in iteritems(self._type_mapping):<EOL><INDENT>v.prepare(self, getattr(self, k))<EOL><DEDENT>message = b'<STR_LIT>'<EOL>for k, v in iteritems(self._type_mapping):<EOL><INDENT>message += v.value_to_bytes(self, getattr(self, k), default_endianness=endianness)<EOL><DEDENT>return message<EOL>
Serialise a message, without including any framing.

: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.
:type default_endianness: str
:return: The serialised message.
:rtype: bytes