def METHOD_NAME(self):
    public_key = self.cleaned_data['public_key']
    if self.instance.public_key and public_key == self.instance.public_key:
        msg = _('Public key should not be the same as your old one.')
        raise forms.ValidationError(msg)
    if public_key and not validate_ssh_public_key(public_key):
        raise forms.ValidationError(_('Not a valid ssh public key'))
    return public_key