def also_test_none_password(check_password_fn):
    """Decorator for check_password, simply to give a friendlier exception if
    check_password(x) is called on a keystore that does not have a password set.
    """
    @wraps(check_password_fn)
    def wrapper(self: 'Software_KeyStore', *args):
        password = args[0]
        try:
            return check_password_fn(self, password)
        except (CiphertextFormatError, InvalidPassword) as e:
            if password is not None:
                try:
                    check_password_fn(self, None)
                except Exception:
                    pass
                else:
                    raise InvalidPassword("password given but keystore has no password") from e
            raise
    return wrapper
Decorator for check_password, simply to give a friendlier exception if
    check_password(x) is called on a keystore that does not have a password set.
    
electrum/keystore.py