def present(name):
    ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}

    # Comment and change messages
    comment_hostgroup_created = 'Host group {0} created.'.format(name)
    comment_hostgroup_notcreated = 'Unable to create host group: {0}. '.format(name)
    comment_hostgroup_exists = 'Host group {0} already exists.'.format(name)
    changes_hostgroup_created = {name: {'old': 'Host group {0} does not exist.'.format(name),
                                        'new': 'Host group {0} created.'.format(name),
                                        }
                                 }

    hostgroup_exists = __salt__['zabbix.hostgroup_exists'](name)

    # Dry run, test=true mode
    if __opts__['test']:
        if hostgroup_exists:
            ret['result'] = True
            ret['comment'] = comment_hostgroup_exists
        else:
            ret['result'] = None
            ret['comment'] = comment_hostgroup_created
            ret['changes'] = changes_hostgroup_created
        return ret

    if hostgroup_exists:
        ret['result'] = True
        ret['comment'] = comment_hostgroup_exists
    else:
        hostgroup_create = __salt__['zabbix.hostgroup_create'](name)

        if 'error' not in hostgroup_create:
            ret['result'] = True
            ret['comment'] = comment_hostgroup_created
            ret['changes'] = changes_hostgroup_created
        else:
            ret['result'] = False
            ret['comment'] = comment_hostgroup_notcreated + str(hostgroup_create['error'])

    return ret
Returns True if the key is in the cache and has not expired.
dataset/ETHPy150Open saltstack/salt/salt/states/zabbix_hostgroup.py/present--crossover with--dataset/ETHPy150Open django/django/django/core/cache/backends/base.py/BaseCache.has_key