def _set_account_policy(name, policy):
    cmd = 'pwpolicy -u {0} -setpolicy "{1}"'.format(name, policy)

    try:
        return salt.utils.mac_utils.execute_return_success(cmd)
    except CommandExecutionError as exc:
        if 'Error: user <{0}> not found'.format(name) in exc.strerror:
            raise CommandExecutionError('User not found: {0}'.format(name))
        raise CommandExecutionError('Unknown error: {0}'.format(exc.strerror))
Set a value in the user accountPolicy. For use by this module only
dataset/ETHPy150Open saltstack/salt/salt/modules/mac_shadow.py/_set_account_policy