a nicer version of sudo that uses getpass to ask for a password, or
    allows the first argument to be a string password

def sudo(orig): # pragma: no cover
    """ a nicer version of sudo that uses getpass to ask for a password, or
    allows the first argument to be a string password """

    prompt = "[sudo] password for %s: " % getpass.getuser()

    def stdin():
        pw = getpass.getpass(prompt=prompt) + "\n"
        yield pw


    def process(args, kwargs):
        password = kwargs.pop("password", None)

        if password is None:
            pass_getter = stdin()
        else:
            pass_getter = password.rstrip("\n") + "\n"

        kwargs["_in"] = pass_getter
        return args, kwargs

    cmd = orig.bake("-S", _arg_preprocess=process)
    return cmd