'For a given host, look for all copy we must create for for_each property
:type host: shinken.objects.host.Host
:return Service'

def duplicate(self, host):

    prop = self.duplicate_foreach.strip().upper()
    if (prop not in host.customs):
        return []
    duplicates = []
    entry = host.customs[prop]
    not_entry = host.customs.get((('_' + '!') + prop[1:]), '').split(',')
    not_keys = strip_and_uniq(not_entry)
    default_value = getattr(self, 'default_value', '')
    (key_values, errcode) = get_key_value_sequence(entry, default_value)
    if key_values:
        for key_value in key_values:
            key = key_value['KEY']
            if (key in not_keys):
                continue
            value = key_value['VALUE']
            new_s = self.copy()
            new_s.host_name = host.get_name()
            if self.is_tpl():
                new_s.register = 1
            for key in key_value:
                if (key == 'KEY'):
                    if hasattr(self, 'service_description'):
                        safe_key_value = re.sub((('[' + '`~!$%^&*"|\'<>?,()=') + ']+'), '_', key_value[key])
                        new_s.service_description = self.service_description.replace((('$' + key) + '$'), safe_key_value)
                _the_expandables = ['check_command', 'display_name', 'aggregation', 'event_handler']
                for prop in _the_expandables:
                    if hasattr(self, prop):
                        setattr(new_s, prop, getattr(new_s, prop).replace((('$' + key) + '$'), key_value[key]))
                if hasattr(self, 'service_dependencies'):
                    for (i, sd) in enumerate(new_s.service_dependencies):
                        new_s.service_dependencies[i] = sd.replace((('$' + key) + '$'), key_value[key])
            duplicates.append(new_s)
    elif (errcode == GET_KEY_VALUE_SEQUENCE_ERROR_SYNTAX):
        err = ("The    custom    property    '%s'    of    the    host    '%s'    is    not    a    valid    entry    %s    for    a    service    generator" % (self.duplicate_foreach.strip(), host.get_name(), entry))
        logger.warning(err)
        host.configuration_errors.append(err)
    elif (errcode == GET_KEY_VALUE_SEQUENCE_ERROR_NODEFAULT):
        err = ("The    custom    property    '%s    'of    the    host    '%s'    has    empty    values    %s    but    the    service    %s    has    no    default_value" % (self.duplicate_foreach.strip(), host.get_name(), entry, self.service_description))
        logger.warning(err)
        host.configuration_errors.append(err)
    elif (errcode == GET_KEY_VALUE_SEQUENCE_ERROR_NODE):
        err = ("The    custom    property    '%s'    of    the    host    '%s'    has    an    invalid    node    range    %s" % (self.duplicate_foreach.strip(), host.get_name(), entry))
        logger.warning(err)
        host.configuration_errors.append(err)
    return duplicates
