def revoke_mail_code(strategy, details, **kwargs):
    """Remove old mail validation code for Python Social Auth.

    PSA keeps them around, but we really don't need them again.
    """
    data = strategy.request_data()
    if 'email' in details and details['email'] and 'verification_code' in data:
        try:
            code = strategy.storage.code.objects.get(code=data[
                'verification_code'], email=details['email'], verified=True)
            code.delete()
        except strategy.storage.code.DoesNotExist:
            return
