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

def _build_host_hash(self, hostname, displayname, collector, description, groups, properties, alertenable):

    self.module.debug('Running    Host._build_host_hash...')
    h = {}
    h['hostName'] = hostname
    h['displayedAs'] = displayname
    h['alertEnable'] = alertenable
    if collector:
        self.module.debug('Collector    property    exists')
        h['agentId'] = collector['id']
    else:
        self.fail(msg='Error:    No    collector    found.    Unable    to    build    host    hash.')
    if description:
        h['description'] = description
    if ((groups is not None) and (groups is not [])):
        self.module.debug('Group    property    exists')
        groupids = ''
        for group in groups:
            groupids = ((groupids + str(self.create_group(group))) + ',')
        h['hostGroupIds'] = groupids.rstrip(',')
    if ((properties is not None) and (properties is not {})):
        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
