import grp
import pwd


def users(root=True):
    """Return a list of local non-system users.
    
    Set root=False to ignore the root/system user.
    """
    user_names = []
    # by default, all locally created users are in the staff group
    staff_users = grp.getgrgid(20).gr_mem
    for su in staff_users:
        u = pwd.getpwnam(su)
        # filter our macOS users by filtering out false pw_shells
        if u.pw_shell == '/usr/bin/false': continue
        # skip if ignoring root user
        if root == False and u.pw_uid == 0: continue
        user_names.append(u.pw_name)
    return(user_names)