def METHOD_NAME(self, source, partition):
    with open(self.output, 'ab') as ofd:
        pos = ofd.tell()
        print("partition {}, pos={}, offset={}".format(partition, pos, self.offsets[partition]))
        if pos > self.offsets[partition]:
            raise Exception("Partitions not in order, unsupported")
        if pos < self.offsets[partition]:
            buf = b'\xFF' * (self.offsets[partition] - pos)
            ofd.write(buf)
        with open(source, 'rb') as rfd:
            ibuf = rfd.read()
            if len(ibuf) > self.sizes[partition]:
                raise Exception("Image {} is too large for partition".format(source))
        ofd.write(ibuf)