def _handle_password(self, password):
        """ Handles getting the password"""
        if password is None:
            password = keyring.get_password('yagmail', self.user)
            if password is None:
                password = keyring.get_password('yagmail', self.user)
            if password is None:
                import getpass
                password = getpass.getpass(
                    'Password for <{}>: '.format(self.user))
                answer = ''
                # Python 2 fix
                while answer != 'y' and answer != 'n':
                    prompt_string = 'Save username and password in keyring? [y/n]: '
                    # pylint: disable=undefined-variable
                    try:
                        answer = raw_input(prompt_string).strip()
                    except __HOLE__:
                        answer = input(prompt_string).strip()
                if answer == 'y':
                    register(self.user, password)
        return password
dataset/ETHPy150Open kootenpv/yagmail/yagmail/yagmail.py/SMTP._handle_password