code: def get_groupnames(self, hostgroups):
          
          group_names = []
          for hostgroup_id in self.hostgroups:
              hostgroup = hostgroups[hostgroup_id]
              group_names.append(hostgroup.get_name())
          return ','.join(sorted(group_names))
docs: Get names of the host's hostgroups
  
          :return: comma separated names of hostgroups alphabetically sorted
          :rtype: str