def iterflattened(self):

        for key, value in self.iteritems():
            if isinstance(value, nested_dict):
                for keykey, value in value.iterflattened():
                    yield (key,) + keykey, value
            else:
                yield (key,), value
iterate through values with nested keys flattened into a tuple
dataset/ETHPy150Open CGATOxford/cgat/CGAT/IOTools.py/nested_dict.iterflattened