Looks up a part of the color scheme. If used for looking up colors, must_be_leaf should be True.

def lookup(self, path, must_be_leaf = False):
        '''Looks up a part of the color scheme. If used for looking up colors, must_be_leaf should be True.'''
        assert(type(path) == type(self.name))

        d = self.color_scheme
        tokens = path.split('.')
        for t in tokens[:-1]:
            d = d.get(t)
            if d == None:
                raise Exception("Path '%s' not found.")
        if must_be_leaf:
            assert(type(d[tokens[-1]]) == type(self.name))
        return d[tokens[-1]]