nodes: 0, module; 1, function_definition; 2, function_name:get_groupnames; 3, parameters; 4, block; 5, identifier:self; 6, identifier:hostgroups; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Get names of the host's hostgroups
  
          :return: comma separated names of hostgroups alphabetically sorted
          :rtype: str
          """; 12, assignment; 13, identifier:hostgroup_id; 14, attribute; 15, block; 16, call; 17, identifier:group_names; 18, list; 19, identifier:self; 20, identifier:hostgroups; 21, expression_statement; 22, expression_statement; 23, attribute; 24, argument_list; 25, assignment; 26, call; 27, string; 28, identifier:join; 29, call; 30, identifier:hostgroup; 31, subscript; 32, attribute; 33, argument_list; 34, string_content:,; 35, identifier:sorted; 36, argument_list; 37, identifier:hostgroups; 38, identifier:hostgroup_id; 39, identifier:group_names; 40, identifier:append; 41, call; 42, identifier:group_names; 43, attribute; 44, argument_list; 45, identifier:hostgroup; 46, identifier:get_name
code: def get_groupnames(self, hostgroups):
          """Get names of the host's hostgroups
  
          :return: comma separated names of hostgroups alphabetically sorted
          :rtype: str
          """
          group_names = []
          for hostgroup_id in self.hostgroups:
              hostgroup = hostgroups[hostgroup_id]
              group_names.append(hostgroup.get_name())
          return ','.join(sorted(group_names))