def create_local_account(user, full_name, password, admin=False, hidden=False):
    """
    create_local_account(user, full_name, password, admin=False)

    Creates a local account on the computer. If admin is True, This
    account will be able to administer the computer
    hiddden=True will only work if the "hide500users" is set to true in the
    loginwindow plist
    """
    dscl_command = "dscl ."
    home_dir = "/Users/%s" % user

    uids = shell_tools.run(
        "%s -list /Users UniqueID | awk \\'{print $2}\\'" % (dscl_command),
        sanitize=False
    )["stdout"].split()
    next_id = map(int, uids)
    next_id.sort()
    next_id = next_id[-1]

    # UIDs less than 500 are hidden, set it equal to 500 to be incremented
    if next_id < 500:
        if not hidden:
            next_id = 500

    # Increment by 1 for the next free UID
    user_id = next_id + 1

    # Create it manually as not to rely on casper
    create_user_commands = [
        "create %s" % home_dir,
        "create %s UserShell /bin/bash" % home_dir,
        "create %s RealName \\'%s\\'" % (home_dir, full_name),
        "create %s UniqueID %s" % (home_dir, user_id),
        "create %s PrimaryGroupID 1000" % home_dir,
        "create %s NFSHomeDirectory%s" % (home_dir, home_dir),
        "passwd %s \\'%s\\'" % (home_dir, password),
    ]
    if admin:
        create_user_commands.append(
            user % "append /Groups/admin GroupMembership %s"
        )

    for command in create_user_commands:
        shell_tools.run("%s %s" % (dscl_command, command))
dataset/ETHPy150Open facebook/IT-CPE/code/lib/modules/sys_tools.py/create_local_account/swapped operands of `%`