def __bytes__(self):
    accum = bytearray(self.header)
    for i in range(len(self.sections)):
        the_sec = self.sections[i]
        hoff = self.headeroffsets[i]
        while (len(accum) % 16):
            accum.append(0)
        new_off = len(accum)
        new_len = len(the_sec)
        accum.extend(the_sec)
        struct.pack_into('>I', accum, (hoff + 20), new_off)
        if (the_sec is self.code):
            for i in range(8, 20, 4):
                struct.pack_into('>I', accum, (hoff + i), new_len)
    while ((len(accum) % self.padmult) != 0):
        accum.extend(b'\x00')
    return bytes(accum)
def __bytes__(self):
    accum = bytearray(self.header)
    for i in range(len(self.sections)):
        the_sec = self.sections[i]
        hoff = self.headeroffsets[i]
        while (len(accum) % 16):
            accum.append(0)
        new_off = len(accum)
        new_len = len(the_sec)
        accum.extend(the_sec)
        struct.pack_into('>I', accum, (hoff + 20), new_off)
        if (the_sec is self.code):
            for i in range(8, 20, 4):
                struct.pack_into('>I', accum, (hoff + i), new_len)
    while ((len(accum) % self.padmult) != 0):
        accum.extend(b'\x00')
    return bytes(accum)