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

def exists(name, **kwargs):
    '''
    Check if a ZFS filesystem or volume or snapshot exists.

    name : string
        name of dataset
    type : string
        also check if dataset is of a certain type, valid choices are:
        filesystem, snapshot, volume, bookmark, or all.

    .. versionadded:: 2015.5.0

    CLI Example:

    .. code-block:: bash

        salt '*' zfs.exists myzpool/mydataset
        salt '*' zfs.exists myzpool/myvolume type=volume

    '''
    ## Configure command
    # NOTE: initialize the defaults
    opts = {}

    # NOTE: set extra config from kwargs
    if kwargs.get('type', False):
        opts['-t'] = kwargs.get('type')

    ## Check if 'name' of 'type' exists
    res = __salt__['cmd.run_all'](
        __utils__['zfs.zfs_command'](
            command='list',
            opts=opts,
            target=name,
        ),
        python_shell=False,
        ignore_retcode=True,
    )

    return res['retcode'] == 0