# Based on this: http://stackoverflow.com/questions/2082152/case-insensitive-dictionary


class CaseInsensitiveDict(dict):
    @staticmethod
    def lower(key):
        return key.lower() if isinstance(key, str) else key

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._convert_keys()

    def __getitem__(self, key):
        return super().__getitem__(self.__class__.lower(key))

    def __setitem__(self, key, value):
        super().__setitem__(self.__class__.lower(key), value)

    def __delitem__(self, key):
        return super().__delitem__(self.__class__.lower(key))

    def __contains__(self, key):
        return super().__contains__(self.__class__.lower(key))

    def pop(self, key, *args, **kwargs):
        return super().pop(self.__class__.lower(key), *args, **kwargs)

    def get(self, key, *args, **kwargs):
        return super().get(self.__class__.lower(key), *args, **kwargs)

    def setdefault(self, key, *args, **kwargs):
        return super().setdefault(self.__class__.lower(key), *args, **kwargs)

    def update(self, e=None, **f):
        super().update(self.__class__(e))
        super().update(self.__class__(**f))

    def _convert_keys(self):
        for k in list(self.keys()):
            v = super().pop(k)
            self.__setitem__(k, v)

@@ -1,8 +1,37 @@
+%22%22%22Case insensitive dict.%22%22%22%0A
 # Based 
@@ -145,16 +145,62 @@
 (dict):%0A
+%0A    %22%22%22A dict which lowercases all keys.%22%22%22%0A%0A
     @sta
@@ -225,24 +225,57 @@
 lower(key):%0A
+        %22%22%22Lowercase the key.%22%22%22%0A
         retu
@@ -356,32 +356,79 @@
 rgs, **kwargs):%0A
+        %22%22%22Initialise case insensitve dict.%22%22%22%0A
         super().
@@ -507,32 +507,67 @@
 m__(self, key):%0A
+        %22%22%22Return item for key.%22%22%22%0A
         return s
@@ -652,16 +652,57 @@
 value):%0A
+        %22%22%22Set item for key to value.%22%22%22%0A
         
@@ -780,32 +780,67 @@
 m__(self, key):%0A
+        %22%22%22Delete item for key.%22%22%22%0A
         return s
@@ -911,32 +911,76 @@
 s__(self, key):%0A
+        %22%22%22Check if dict contains a key.%22%22%22%0A
         return s
@@ -1060,32 +1060,85 @@
 rgs, **kwargs):%0A
+        %22%22%22Retrieve and delete a value for a key.%22%22%22%0A
         return s
@@ -1226,32 +1226,67 @@
 rgs, **kwargs):%0A
+        %22%22%22Return item for key.%22%22%22%0A
         return s
@@ -1381,32 +1381,60 @@
 rgs, **kwargs):%0A
+        %22%22%22Set defaults.%22%22%22%0A
         return s
@@ -1488,32 +1488,32 @@
 rgs, **kwargs)%0A%0A
-
     def update(s
@@ -1527,24 +1527,64 @@
 None, **f):%0A
+        %22%22%22Update a value for a key.%22%22%22%0A
         supe

fix docstring