'Returns two dicts:
`binary_choices` : dictionary {input_name: input_value} for
the binary choices which the student selected.
and
`numtolerance_choices` : a dictionary {input_name: input_value}
for the numtolerance_inputs inside of choices which were selected
Determines if an input is inside of a binary input by looking at
the beginning of it\'s name.
For example. If a binary_choice was named \'1_2_1_choiceinput_0bc\'
All of the numtolerance_inputs in it would have an idea that begins
with \'1_2_1_choice_input_0_numtolerance_input\'
Splits the name of the numtolerance_input at the occurence of
\'_numtolerance_input_\' and appends \'bc\' to the end to get the name
of the choice it is contained in.
Example:
`a_dict` = {
\'1_2_1_choiceinput_0bc\': \'1_2_1_choiceinput_0bc\',
\'1_2_1_choiceinput_0_numtolerance_input_0\': \'1\',
\'1_2_1_choiceinput_0_numtolerance_input_1\': \'2\'
\'1_2_1_choiceinput_1_numtolerance_input_0\': \'3\'
In this case, the binary choice is \'1_2_1_choiceinput_0bc\', and
the numtolerance_inputs associated with it are
\'1_2_1_choiceinput_0_numtolerance_input_0\', and
\'1_2_1_choiceinput_0_numtolerance_input_1\'.
so the two return dictionaries would be
`binary_choices` = {\'1_2_1_choiceinput_0bc\': \'1_2_1_choiceinput_0bc\'}
and
`numtolerance_choices` ={
\'1_2_1_choiceinput_0_numtolerance_input_0\': \'1\',
\'1_2_1_choiceinput_0_numtolerance_input_1\': \'2\'
The entry \'1_2_1_choiceinput_1_numtolerance_input_0\': \'3\' is discarded
because it was not inside of a selected binary choice, and no validation
should be performed on numtolerance_inputs inside of non-selected choices.'

def _split_answers_dict(self, a_dict):

    numtolerance_choices = {}
    binary_choices = {}
    selected_choices = [key for key in a_dict if key.endswith('bc')]
    for key in selected_choices:
        binary_choices[key] = a_dict[key]
    selected_numtolerance_inputs = [key for key in a_dict if ((key.partition('_numtolerance_input_')[0] + 'bc') in selected_choices)]
    for key in selected_numtolerance_inputs:
        numtolerance_choices[key] = a_dict[key]
    return (binary_choices, numtolerance_choices)
