'Output the MHTML file to the given file-like object.
Args:
fp: The file-object, opened in "wb" mode.'

def write_to(self, fp):

    msg = email.mime.multipart.MIMEMultipart('related', '---=_qute-{}'.format(uuid.uuid4()))
    root = self._create_root_file()
    msg.attach(root)
    for (_, file_data) in sorted(self._files.items()):
        msg.attach(self._create_file(file_data))
    gen = email.generator.BytesGenerator(fp, policy=MHTMLPolicy)
    gen.flatten(msg)
