@requires_active_transfer
    def transfer_domain(self, *args, **kwargs):

        self.confirm_time = datetime.utcnow()
        if 'ip' in kwargs:
            self.confirm_ip = kwargs['ip']

        self.from_user.transfer_domain_membership(self.domain, self.to_user, is_admin=True)
        self.from_user.save()
        self.to_user.save()
        self.active = False
        self.save()

        html_content = render_to_string(
            "{template}.html".format(template=self.DIMAGI_CONFIRM_EMAIL),
            self.as_dict())
        text_content = render_to_string(
            "{template}.txt".format(template=self.DIMAGI_CONFIRM_EMAIL),
            self.as_dict())

        send_html_email_async.delay(
            _(u'There has been a transfer of ownership of {domain}').format(
                domain=self.domain), self.DIMAGI_CONFIRM_ADDRESS,
            html_content, text_content=text_content
        )
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/domain/models.py/TransferDomainRequest.transfer_domain/original