<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean_new_password2(self):
 """Check if passwords match and are valid."""

        password1 = self.cleaned_data.get('new_password1')
        password2 = self.cleaned_data.get('new_password2')

        try:
            directory = APPLICATION.default_account_store_mapping.account_store
            directory.password_policy.strength.validate_password(password2)
        except ValueError as e:
            raise forms.ValidationError(str(e))

        if password1 and password2:
            if password1 != password2:
                raise forms.ValidationError("The two passwords didn't match.")

        return password2