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

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