'Write the epub file.
It is a zip file with the mimetype file stored uncompressed as the first
entry.'

def build_epub(self, outdir, outname):

    logger.info('writing    %s    file...', outname)
    epub_filename = path.join(outdir, outname)
    with ZipFile(epub_filename, 'w', ZIP_DEFLATED) as epub:
        epub.write(path.join(outdir, 'mimetype'), 'mimetype', ZIP_STORED)
        for filename in [u'META-INF/container.xml', u'content.opf', u'toc.ncx']:
            epub.write(path.join(outdir, filename), filename, ZIP_DEFLATED)
        for filename in self.files:
            epub.write(path.join(outdir, filename), filename, ZIP_DEFLATED)
