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

def uninstalled(name):
    '''
    Ensure that the named package is not installed.

    Args:
        name (str): The flatpak package.

    Returns:
        dict: The ``result`` and ``output``.

    Example:

    .. code-block:: yaml

        uninstall_package:
          flatpack.uninstalled:
            - name: gimp
    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    old = __salt__['flatpak.is_installed'](name)
    if not old:
        ret['comment'] = 'Package {0} is not installed'.format(name)
        ret['result'] = True
        return ret
    else:
        if __opts__['test']:
            ret['comment'] = 'Package {0} would have been uninstalled'.format(name)
            ret['changes']['old'] = old[0]['version']
            ret['changes']['new'] = None
            ret['result'] = None
            return ret

        __salt__['flatpak.uninstall'](name)
        if not __salt__['flatpak.is_installed'](name):
            ret['comment'] = 'Package {0} uninstalled'.format(name)
            ret['changes']['old'] = old[0]['version']
            ret['changes']['new'] = None
            ret['result'] = True
            return ret