import getpass


def _set_shells(options):
    """Set password, shell and extra prompts for the username.

    Args:
        options dictionary with username, jump_user and extra_prompts keys.

    Returns:
        options dictionary with shell_prompts and passwd_prompts keys
    """

    shells = [
        "mysql\\>",
        "ftp\\>",
        "telnet\\>",
        "\\[root\\@.*\\]\\#",
        "root\\@.*\\:\\~\\#",
    ]
    password_shells = ["(yes/no)\\\?", "assword:"]

    if not options["username"]:
        options["username"] = getpass.getuser()

    shells.append("\\[{0}@.*\\]\\$".format(options["username"]))
    shells.append("{0}@.*:~\\$".format(options["username"]))
    password_shells.append("{0}@.*assword\\:".format(options["username"]))
    password_shells.append("{0}\\:".format(options["username"]))

    if options["jump_user"]:
        shells.append("\\[{0}@.*\\]\\$".format(options["jump_user"]))
        shells.append("{0}@.*:~\\$".format(options["jump_user"]))
        password_shells.append("{0}@.*assword:".format(options["jump_user"]))
        password_shells.append("{0}:".format(options["jump_user"]))

    options["shell_prompts"] = shells
    options["passwd_prompts"] = password_shells

    if not isinstance(options["extra_prompts"], (list, tuple)):
        options["extra_prompts"] = [options["extra_prompts"]]

    return options