Yes, I see what you are worring about.
But, sometimes we will login remote in the way of public/private-key which need no password.
So we can't assume that remore_pwd is not None.