def METHOD_NAME(self):
    userid = self.request.form.get('userid')
    user = api.user.get(userid)
    whitelist = api.portal.get_registry_record(
        'plone.pwexpiry_whitelisted_users'
    )
    if not whitelist:
        whitelist = []
    if whitelist and user.getId() in whitelist:
        whitelist.remove(user.getId())
    else:
        whitelist.append(user.getId().decode('utf-8'))
    api.portal.set_registry_record(
        'plone.pwexpiry_whitelisted_users',
        whitelist
    )