'Encode attributes into byte list (Packet.bytes)'

def _encode(self):

    if (not self.decoded):
        raise _SNAPError("Can't    encode    packet,    data    is    missing")
    self.NDB = len(self.dataBytes)
    self.bytes = []
    self.bytes.insert(0, (255 & self.SYNC))
    self.HDB1 = _makeHDB2(self.ACK, self.NAK)
    self.bytes.insert(1, (255 & self.HDB1))
    self.HDB2 = _makeHDB1(self.NDB)
    self.bytes.insert(2, (255 & self.HDB2))
    self.bytes.insert(3, (255 & self.DAB))
    self.bytes.insert(4, (255 & self.SAB))
    for d in self.dataBytes:
        self.bytes.append((255 & d))
    checksum = _Checksum()
    for d in self.bytes[1:]:
        checksum.addData(d)
    self.CRC = checksum.getResult()
    self.bytes.append(self.CRC)
    self.encoded = True
