'Create a <checkboxgroup> element.
choices can be specified in the following format:
[("true", [{"answer": "5", "tolerance": 0}]),
("false", [{"answer": "5", "tolerance": 0}])
This indicates that the first checkbox/radio is correct and it
contains a numtolerance_input with an answer of 5 and a tolerance of 0
It also indicates that the second has a second incorrect radiobutton
or checkbox with a numtolerance_input.'

def create_input_element(self, **kwargs):

    choices = kwargs.get('choices', [('true', {})])
    choice_inputs = []
    if (not isinstance(choices[0], (list, tuple))):
        choices = [choices]
    for choice in choices:
        (correctness, answers) = choice
        numtolerance_inputs = []
        if answers:
            if (not isinstance(answers, (list, tuple))):
                answers = [answers]
            numtolerance_inputs = [self._create_numtolerance_input_element(answer) for answer in answers]
        choice_inputs.append(self._create_choice_element(correctness=correctness, inputs=numtolerance_inputs))
    input_type = kwargs.get('type', 'radiotextgroup')
    input_element = etree.Element(input_type)
    for (ind, choice) in enumerate(choice_inputs):
        choice.text = 'choice_{0}'.format(ind)
        input_element.append(choice)
    return input_element
