def coloringfromstring(s):
    """
    Attempts to convert a string representation of a coloring dictionary (as 
    would be read from a file header, for instance) into an actual coloring 
    dictionary.
    
    """
    try:
        AST = compiler.parse(s)
    except SyntaxError:
        return
    else:
        try:
            if len(AST.getChildren()) > 1:
                ST = AST.getChildren()[1]
                if isinstance(ST, Stmt) and isinstance(ST.getChildren()[0],
                                                                     Discard):
                    d = ST.getChildren()[0].asList()[0]
        except (TypeError, AttributeError):
            pass
        else:
            if isinstance(d,Dict) and len(d.items) > 0:
                if all([isctype(i[0],str) for i in d.items]):
                    if all([isinstance(i[1],List) for i in d.items]):
                        if all([all([isctype(j,str) for j in i[1]]) for i in 
                                                                      d.items]):
                            return eval(s)
Attempts to convert a string representation of a coloring dictionary (as 
    would be read from a file header, for instance) into an actual coloring 
    dictionary.