def METHOD_NAME(template_zip, output_file, dom_trees):
    """Write the translated IDML package."""
    output_zip = ZipFile(output_file, "w", compression=ZIP_DEFLATED)
    # Copy the IDML package.
    output_zip = copy_idml(template_zip, output_zip, dom_trees.keys())
    # Replace the translated files in the IDML package.
    for filename, dom_tree in dom_trees.items():
        output_zip.writestr(
            filename,
            etree.tostring(
                dom_tree, encoding="UTF-8", xml_declaration=True, standalone="yes"
            ),
        )