Call the given C{action} with a secret value.

    @return: a L{Deferred} that fires with C{action}'s result, or
        L{NoSecretError} if no secret can be retrieved.

def secretly(reactor, action, system=None, username=None,
             prompt="Password:"):
    """
    Call the given C{action} with a secret value.

    @return: a L{Deferred} that fires with C{action}'s result, or
        L{NoSecretError} if no secret can be retrieved.
    """
    if system is None:
        system = action.__module__
        if system == '__main__':
            system = os.path.abspath(sys.argv[0])
    if username is None:
        username = getpass.getuser()
    while True:
        secret = keyring.get_password(system, username)
        if secret is not None:
            break
        pinentry = yield choosePinentry()
        keyring.set_password(
            system, username,
            (yield pinentry.askForPassword(
                reactor, prompt, "Enter Password",
                "Password Prompt for {username}@{system}"
                .format(system=system, username=username)))
        )
    yield maybeDeferred(action, secret)