'Takes in:
1. list of choices
2. random number generator
3. the requested size "answer-pool" number, in effect a max
Returns a tuple with 2 items:
1. the solution_id corresponding with the chosen correct answer
2. (subset) list of choice nodes with num-1 incorrect and 1 correct
Raises an error if the number of correct or incorrect choices is 0.'

def sample_from_answer_pool(self, choices, rng, num_pool):

    correct_choices = []
    incorrect_choices = []
    for choice in choices:
        if (choice.get('correct').upper() == 'TRUE'):
            correct_choices.append(choice)
        else:
            incorrect_choices.append(choice)
    if ((len(correct_choices) < 1) or (len(incorrect_choices) < 1)):
        _ = self.capa_system.i18n.ugettext
        msg = _('Choicegroup    must    include    at    least    1    correct    and    1    incorrect    choice')
        raise LoncapaProblemError(msg)
    num_incorrect = (num_pool - 1)
    num_incorrect = min(num_incorrect, len(incorrect_choices))
    index = rng.randint(0, (len(correct_choices) - 1))
    correct_choice = correct_choices[index]
    solution_id = correct_choice.get('explanation-id')
    subset_choices = [correct_choice]
    rng.shuffle(incorrect_choices)
    subset_choices += incorrect_choices[:num_incorrect]
    rng.shuffle(subset_choices)
    return (solution_id, subset_choices)
