def _get_framed(self, buf, offset, insert_payload):
header_offset = offset + self._header_len<EOL>self.length = insert_payload(buf, header_offset, self.payload)<EOL>struct.pack_into(self._header_fmt,<EOL>buf,<EOL>offset,<EOL>self.preamble,<EOL>self.msg_type,<EOL>self.sender,<EOL>self.length)<EOL>crc_offset = header_offset + self.length<EOL>preamble_bytes = <NUM_LIT:1><EOL>crc_over_len = self._header_len + self.length - preamble_bytes<EOL>self.crc = crc16jit(buf, offset+<NUM_LIT:1>, <NUM_LIT:0>, crc_over_len)<EOL>struct.pack_into(self._crc_fmt, buf, crc_offset, self.crc)<EOL>length = preamble_bytes + crc_over_len + self._crc_len<EOL>return length<EOL>
Returns the framed message and updates the CRC.