def _ask_password():
    """Securely and interactively ask for a password"""

    password = "Foo"
    password_trial = ""

    while password != password_trial:
        password = getpass.getpass()
        password_trial = getpass.getpass(prompt="Repeat:")
        if password != password_trial:
            print("\nPasswords do not match!")

    return password
def _ask_password ( ) : password = "Foo" password_trial = "" while password != password_trial : password = getpass . getpass ( ) password_trial = getpass . getpass ( prompt = "Repeat:" ) if password != password_trial : print ( "\nPasswords do not match!" ) return password
Securely and interactively ask for a password