'Registers a service into the service groups declared in its
`servicegroups` attribute.
:param s:   The service to register
:param servicegroups:   The servicegroups container'

def register_service_into_servicegroups(self, s, servicegroups):

    if hasattr(s, 'service_description'):
        sname = s.service_description
        shname = getattr(s, 'host_name', '')
        if hasattr(s, 'servicegroups'):
            if isinstance(s.servicegroups, list):
                sgs = s.servicegroups
            else:
                sgs = s.servicegroups.split(',')
            for sg in sgs:
                servicegroups.add_member([shname, sname], sg.strip())
