'Replaces the keys in a MultiValueDict marked as sensitive with stars.
This mitigates leaking sensitive POST parameters if something like
request.POST[\'nonexistent_key\'] throws an exception (#21098).'

def get_cleansed_multivaluedict(self, request, multivaluedict):

    sensitive_post_parameters = getattr(request, u'sensitive_post_parameters', [])
    if (self.is_active(request) and sensitive_post_parameters):
        multivaluedict = multivaluedict.copy()
        for param in sensitive_post_parameters:
            if (param in multivaluedict):
                multivaluedict[param] = CLEANSED_SUBSTITUTE
    return multivaluedict
