'Compound hints are a type of extended hint specific to checkboxgroup with the
<compoundhint value="A C"> meaning choices A and C were selected.
Checks for a matching compound hint, installing it in new_cmap.
Returns True if compound condition hints were matched.'

def get_compound_hints(self, new_cmap, student_answers):

    compound_hint_matched = False
    if (self.answer_id in student_answers):
        student_set = set()
        names = []
        for student_answer in student_answers[self.answer_id]:
            choice_list = self.xml.xpath('//checkboxgroup[@id=$id]/choice[@name=$name]', id=self.answer_id, name=student_answer)
            if choice_list:
                choice = choice_list[0]
                student_set.add(choice.get('id').upper())
                names.append(student_answer)
        for compound_hint in self.xml.xpath('//checkboxgroup[@id=$id]/compoundhint', id=self.answer_id):
            selectors = compound_hint.get('value').upper().split()
            selector_set = set(selectors)
            if (selector_set == student_set):
                hint_text = compound_hint.text.strip()
                choices = self.xml.xpath('//checkboxgroup[@id=$id]/choice', id=self.answer_id)
                choice_all = [choice.get('name') for choice in choices]
                hint_log = [{'text': hint_text, 'trigger': [{'choice': name, 'selected': True} for name in names]}]
                new_cmap[self.answer_id]['msg'] += self.make_hint_div(compound_hint, (new_cmap[self.answer_id]['correctness'] == 'correct'), student_answers[self.answer_id], self.tags[0], hint_log=hint_log, log_extra={'trigger_type': 'compound', 'choice_all': choice_all})
                compound_hint_matched = True
                break
    return compound_hint_matched
