<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def explode_hostgroup(self, svc_dep, hostgroups):
 # pylint: disable=too-many-locals """Explode a service dependency for each member of hostgroup :param svc_dep: service dependency to explode :type svc_dep: alignak.objects.servicedependency.Servicedependency :param hostgroups: used to find hostgroup objects :type hostgroups: alignak.objects.hostgroup.Hostgroups :return:None """

        # We will create a service dependency for each host part of the host group

        # First get services
        snames = [d.strip() for d in svc_dep.service_description.split(',')]

        # And dep services
        dep_snames = [d.strip() for d in svc_dep.dependent_service_description.split(',')]

        # Now for each host into hostgroup we will create a service dependency object
        hg_names = [n.strip() for n in svc_dep.hostgroup_name.split(',')]
        for hg_name in hg_names:
            hostgroup = hostgroups.find_by_name(hg_name)
            if hostgroup is None:
                err = "ERROR: the servicedependecy got an unknown hostgroup_name '%s'" % hg_name
                self.add_error(err)
                continue
            hnames = []
            hnames.extend([m.strip() for m in hostgroup.get_hosts()])
            for hname in hnames:
                for dep_sname in dep_snames:
                    for sname in snames:
                        new_sd = svc_dep.copy()
                        new_sd.host_name = hname
                        new_sd.service_description = sname
                        new_sd.dependent_host_name = hname
                        new_sd.dependent_service_description = dep_sname
                        self.add_item(new_sd)