'Return a property formatted hash for the
creation of a hostgroup using the rpc function'

def _build_host_group_hash(self, fullpath, description, properties, alertenable):

    self.module.debug('Running    Hostgroup._build_host_hash')
    h = {}
    h['alertEnable'] = alertenable
    if (fullpath == '/'):
        self.module.debug('Group    is    root')
        h['id'] = 1
    else:
        self.module.debug('Determining    group    path')
        (parentpath, name) = fullpath.rsplit('/', 1)
        parent = self.get_group(parentpath)
        h['name'] = name
        if parent:
            self.module.debug((('Parent    group    ' + str(parent['id'])) + '    found.'))
            h['parentID'] = parent['id']
        else:
            self.module.debug('No    parent    group    found.    Using    root.')
            h['parentID'] = 1
    if description:
        self.module.debug('Description    property    exists')
        h['description'] = description
    if (properties != {}):
        self.module.debug('Properties    hash    exists')
        propnum = 0
        for (key, value) in properties.items():
            h[('propName' + str(propnum))] = key
            h[('propValue' + str(propnum))] = value
            propnum = (propnum + 1)
    return h
