'Make dictionary of student responses (aka "answers")
`data` is POST dictionary (webob.multidict.MultiDict).
The `data` dict has keys of the form \'x_y\', which are mapped
to key \'y\' in the returned dict.  For example,
\'input_1_2_3\' would be mapped to \'1_2_3\' in the returned dict.
Some inputs always expect a list in the returned dict
(e.g. checkbox inputs).  The convention is that
keys in the `data` dict that end with \'[]\' will always
have list values in the returned dict.
For example, if the `data` dict contains {\'input_1[]\': \'test\' }
then the output dict would contain {\'1\': [\'test\'] }
(the value is a list).
Some other inputs such as ChoiceTextInput expect a dict of values in the returned
dict  If the key ends with \'{}\' then we will assume that the value is a json
encoded dict and deserialize it.
For example, if the `data` dict contains {\'input_1{}\': \'{"1_2_1": 1}\'}
then the output dict would contain {\'1\': {"1_2_1": 1} }
(the value is a dictionary)
Raises an exception if:
-A key in the `data` dictionary does not contain at least one underscore
(e.g. "input" is invalid, but "input_1" is valid)
-Two keys end up with the same name in the returned dict.
(e.g. \'input_1\' and \'input_1[]\', which both get mapped to \'input_1\'
in the returned dict)'

@staticmethod
def make_dict_of_responses(data):

    answers = dict()
    for key in set(data.keys()):
        (_, _, name) = key.partition('_')
        if (not name):
            raise ValueError(u'{key}    must    contain    at    least    one    underscore'.format(key=key))
        else:
            is_list_key = name.endswith('[]')
            is_dict_key = name.endswith('{}')
            name = (name[:(-2)] if (is_list_key or is_dict_key) else name)
            if is_list_key:
                val = data.getall(key)
            elif is_dict_key:
                try:
                    val = json.loads(data[key])
                except (KeyError, ValueError):
                    raise ValueError(u'Invalid    submission:    {val}    for    {key}'.format(val=data[key], key=key))
            else:
                val = data[key]
            if (name in answers):
                raise ValueError(u'Key    {name}    already    exists    in    answers    dict'.format(name=name))
            else:
                answers[name] = val
    return answers
