code: def explode_services_duplicates(self, hosts, service):
          
          hname = getattr(service, "host_name", None)
          if hname is None:
              return
  
          # the generator case, we must create several new services
          # we must find our host, and get all key:value we need
          host = hosts.find_by_name(hname.strip())
          if host is None:
              service.add_error('Error: The hostname %s is unknown for the service %s!'
                                % (hname, service.get_name()))
              return
  
          # Duplicate services
          for new_s in service.duplicate(host):
              if host.is_excluded_for(new_s):
                  continue
              # Adds concrete instance
              self.add_item(new_s)
docs: Explodes services holding a `duplicate_foreach` clause.
  
          :param hosts: The hosts container
          :type hosts: alignak.objects.host.Hosts
          :param service: The service to explode
          :type service: alignak.objects.service.Service