def list_users(root=None):
    '''
    .. versionadded:: 2018.3.0

    Return a list of all shadow users

    root
        Directory to chroot into

    CLI Example:

    .. code-block:: bash

        salt '*' shadow.list_users
    '''
    if root is not None:
        getspall = functools.partial(_getspall, root=root)
    else:
        getspall = functools.partial(spwd.getspall)

    return sorted([user.sp_namp if hasattr(user, 'sp_namp') else user.sp_nam
                   for user in getspall()])