forked from: babakness/caselessDictionary.py (on gist)
Dictionary that enables case insensitive searching while preserving case sensitivity when keys are listed, ie, via keys() or items() methods. Works by storing a lowercase version of the key as the new key and stores the original key-value pair as the key's value (values become dictionaries).
>>> d = CaselessDictionary()
>>> d['Aa'] = 'Bb'
>>> print(d)
{'Aa': 'Bb'}
>>> d['aA']
'Bb'
>>> d['aa']
'Bb'
{'aa': {'key': 'Aa', 'val': 'Bb'}}