def _invert_dictionary(self, d):
        """Invert a dictionary.
        """
        inv_dict = {}

        for k, v in d.items():
            inv_dict[v] = inv_dict.get(v, [])
            inv_dict[v] += [k]

        return inv_dict