code: def explode_services_from_hosts(self, hosts, service, hnames):
          duplicate_for_hosts = []
          not_hosts = []
          for hname in hnames:
              hname = hname.strip()
              if hname.startswith('!'):
                  not_hosts.append(hname[1:])
              else:
                  duplicate_for_hosts.append(hname)
          duplicate_for_hosts = list(set(duplicate_for_hosts))
          for hname in not_hosts:
              try:
                  duplicate_for_hosts.remove(hname)
              except IndexError:
                  pass
          for hname in duplicate_for_hosts:
              host = hosts.find_by_name(hname)
              if host is None:
                  service.add_error("Error: The hostname %s is unknown for the service %s!"
                                    % (hname, service.get_name()))
                  continue
              if host.is_excluded_for(service):
                  continue
              new_s = service.copy()
              new_s.host_name = hname
              self.add_item(new_s)