def generation(self):
        """Returns the number of ancestors that are dictionaries"""
        if not self.parent:
            return 0
        elif self.parent.is_dict:
            return 1 + self.parent.generation
        else:
            return self.parent.generation