def unsubscribe_mailchimp(list_name, user_id, username=None, send_goodbye=True):
 user = User.load(user_id)
 m = get_mailchimp_api()
 list_id = get_list_id_from_name(list_name=list_name)
 m.lists.unsubscribe(id=list_id, email={'email': (username or user.username)}, send_goodbye=send_goodbye)
 if (user.mailchimp_mailing_lists is None):
  user.mailchimp_mailing_lists = {}
  user.save()
 user.mailchimp_mailing_lists[list_name] = False
 user.save()

def unsubscribe_mailchimp ( list_name , user_id , username = None , send_goodbye = True ) : user = User . load ( user_id ) m = get_mailchimp_api ( ) list_id = get_list_id_from_name ( list_name = list_name ) m . lists . unsubscribe ( id = list_id , email = { 'email' : ( username or user . username ) } , send_goodbye = send_goodbye ) if ( user . mailchimp_mailing_lists is None ) : user . mailchimp_mailing_lists = { } user . save ( ) user . mailchimp_mailing_lists [ list_name ] = False user . save ( )
unsubscribe a user from a mailchimp mailing list given its name .