def marketing_pref_update_receiver(sender, instance, *args, **kwargs):
    if (instance.subscribed != instance.mailchimp_subscribed):
        if instance.subscribed:
            (status_code, response_data) = Mailchimp().subscribe(instance.user.email)
        else:
            (status_code, response_data) = Mailchimp().unsubscribe(instance.user.email)
        if (response_data['status'] == 'subscribed'):
            instance.subscribed = True
            instance.mailchimp_subscribed = True
            instance.mailchimp_msg = response_data
        else:
            instance.subscribed = False
            instance.mailchimp_subscribed = False
            instance.mailchimp_msg = response_data
def marketing_pref_update_receiver(sender, instance, *args, **kwargs):
    if (instance.subscribed != instance.mailchimp_subscribed):
        if instance.subscribed:
            (status_code, response_data) = Mailchimp().subscribe(instance.user.email)
        else:
            (status_code, response_data) = Mailchimp().unsubscribe(instance.user.email)
        if (response_data['status'] == 'subscribed'):
            instance.subscribed = True
            instance.mailchimp_subscribed = True
            instance.mailchimp_msg = response_data
        else:
            instance.subscribed = False
            instance.mailchimp_subscribed = False
            instance.mailchimp_msg = response_data