<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def list_users(root=None):
    '''
    Return a list of all users

    root
        Directory to chroot into

    CLI Example:

    .. code-block:: bash

        salt '*' user.list_users
    '''
    if root is not None and __grains__['kernel'] != 'AIX':
        getpwall = functools.partial(_getpwall, root=root)
    else:
        getpwall = functools.partial(pwd.getpwall)

    return sorted([user.pw_name for user in getpwall()])