def get_mail_preview(self, template_name, lang, cid_to_data=False):
        form_class = factory.get_mail_form(self.mail_name)
        form = form_class(mail_class=self.mail_class)

        form = form_class(form.get_context_data(), mail_class=self.mail_class)
        data = form.get_context_data()
        if form.is_valid():
            data.update(form.cleaned_data)

        # overwrite with preview data if any
        data.update(form.get_preview_data())

        mail = self.mail_class(data)
        message = mail.create_email_msg([settings.ADMINS], lang=lang)

        try:
            message.html = factory.get_html_for(self.mail_name, data,
                                                lang=lang, cid_to_data=True)
        except TemplateDoesNotExist:
            message.html = False

        return message
Hypervisor parameter validation.
dataset/ETHPy150Open novafloss/django-mail-factory/mail_factory/views.py/MailPreviewMixin.get_mail_preview--crossover with--dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/common.py/CheckHVParams