def hostgroup_exists(name=None, groupid=None, node=None, nodeids=None, **connection_args):
 conn_args = _login(**connection_args)
 zabbix_version = apiinfo_version(**connection_args)
 try:
  if conn_args:
   if (LooseVersion(zabbix_version) > LooseVersion('2.5')):
    if (not groupid):
     groupid = None
    if (not name):
     name = None
    ret = hostgroup_get(name, groupid, **connection_args)
    return bool(ret)
   else:
    params = {}
    method = 'hostgroup.exists'
    if groupid:
     params['groupid'] = groupid
    if name:
     params['name'] = name
    if (LooseVersion(zabbix_version) < LooseVersion('2.4')):
     if node:
      params['node'] = node
     if nodeids:
      params['nodeids'] = nodeids
    if ((not groupid) and (not name) and (not node) and (not nodeids)):
     return {'result': False, 'comment': 'Please submit groupid, name, node or nodeids parameter tocheck if at least one host group that matches the given filter criteria exists.'}
    ret = _query(method, params, conn_args['url'], conn_args['auth'])
    return ret['result']
  else:
   raise KeyError
 except KeyError:
  return False

def hostgroup_exists ( name = None , groupid = None , node = None , nodeids = None , ** connection_args ) : conn_args = _login ( ** connection_args ) zabbix_version = apiinfo_version ( ** connection_args ) try : if conn_args : if ( LooseVersion ( zabbix_version ) > LooseVersion ( '2.5' ) ) : if ( not groupid ) : groupid = None if ( not name ) : name = None ret = hostgroup_get ( name , groupid , ** connection_args ) return bool ( ret ) else : params = { } method = 'hostgroup.exists' if groupid : params [ 'groupid' ] = groupid if name : params [ 'name' ] = name if ( LooseVersion ( zabbix_version ) < LooseVersion ( '2.4' ) ) : if node : params [ 'node' ] = node if nodeids : params [ 'nodeids' ] = nodeids if ( ( not groupid ) and ( not name ) and ( not node ) and ( not nodeids ) ) : return { 'result' : False , 'comment' : 'Please submit groupid, name, node or nodeids parameter tocheck if at least one host group that matches the given filter criteria exists.' } ret = _query ( method , params , conn_args [ 'url' ] , conn_args [ 'auth' ] ) return ret [ 'result' ] else : raise KeyError except KeyError : return False
checks if at least one host group that matches the given filter criteria exists .