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

def unmapped(name,
             config='/etc/crypttab',
             persist=True,
             immediate=False):
    '''
    Ensure that a device is unmapped

    name
        The name to ensure is not mapped

    config
        Set an alternative location for the crypttab, if the map is persistent,
        Default is ``/etc/crypttab``

    persist
        Set if the map should be removed from the crypttab. Default is ``True``

    immediate
        Set if the device should be unmapped immediately. Default is ``False``.
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}

    if immediate:
        # Get the active crypt mounts. If ours is not listed already, no action is necessary.
        active = __salt__['cryptdev.active']()
        if name in active.keys():
            # Close the map using cryptsetup.
            if __opts__['test']:
                ret['result'] = None
                ret['commment'] = 'Device would be unmapped immediately'
            else:
                cryptsetup_result = __salt__['cryptdev.close'](name)
                if cryptsetup_result:
                    ret['changes']['cryptsetup'] = 'Device unmapped using cryptsetup'
                else:
                    ret['changes']['cryptsetup'] = 'Device failed to unmap using cryptsetup'
                    ret['result'] = False

    if persist and not __opts__['test']:
        crypttab_result = __salt__['cryptdev.rm_crypttab'](name, config=config)
        if crypttab_result:
            if crypttab_result == 'change':
                ret['changes']['crypttab'] = 'Entry removed from {0}'.format(config)

        else:
            ret['changes']['crypttab'] = 'Unable to remove entry in {0}'.format(config)
            ret['result'] = False

    return ret