'Convert header and payload to bytes'

def pack(self):

    if ((self.parsed is False) and (self.raw is not None) and (self.next is None)):
        return self.raw
    self.pre_hdr()
    if (self.next == None):
        return self.hdr('')
    elif isinstance(self.next, packet_base):
        rest = self.next.pack()
    else:
        rest = self.next
    return (self.hdr(rest) + rest)
