def update(self, attrs):
<EOL>def convertStrToDict(strVal):<EOL><INDENT>if isinstance(strVal, dict): return strVal<EOL>strVal = re.sub("<STR_LIT>", "<STR_LIT>", str(strVal))<EOL>regexCol = re.compile("<STR_LIT::>")<EOL>terms = re.split("<STR_LIT>", strVal)<EOL>keyvals = [re.split(regexCol, t) for t in terms]<EOL>x = re.compile("<STR_LIT>")<EOL>ret = {}<EOL>boolTrue  = re.compile("<STR_LIT:true>" , flags=re.IGNORECASE)<EOL>boolFalse = re.compile("<STR_LIT:false>", flags=re.IGNORECASE)<EOL>for k, v in keyvals:<EOL><INDENT>k = re.sub(x, "<STR_LIT>", k)<EOL>v = re.sub(x, "<STR_LIT>", v)<EOL>if   re.search(boolTrue, v):    v = True<EOL>elif re.search(boolFalse, v):   v = False<EOL>else:<EOL><INDENT>if '<STR_LIT:.>' in v:<EOL><INDENT>try:                    v = float(v)<EOL>except:                 pass<EOL><DEDENT>else:<EOL><INDENT>try:                    v = int(v)<EOL>except:                 pass<EOL><DEDENT><DEDENT>ret[k] = v<EOL><DEDENT>return ret<EOL><DEDENT>self._validateAttrs(attrs)<EOL>for k,v in iteritems(attrs):<EOL><INDENT>typecast = type( getattr(self, k) )<EOL>if typecast==bool and v=="<STR_LIT:False>":   newval = False <EOL>elif issubclass(typecast, c.RestrictedType): <EOL><INDENT>newval = typecast(v)<EOL><DEDENT>elif "<STR_LIT:<>" in str(v) or v==None:      newval = typecast(v)<EOL>elif k == "<STR_LIT>":                newval = str(v) <EOL>elif k == "<STR_LIT>":            newval = convertStrToDict(v)<EOL>else:                               newval = typecast(str(v).lower())<EOL>setattr(self, k, newval)<EOL><DEDENT>if self.isComputer: pass<EOL>elif "<STR_LIT>" in attrs and attrs["<STR_LIT>"]!=None: <EOL><INDENT>raise ValueError("<STR_LIT>"%(<EOL>self.__class__.__name__, self.type.__class__.__name__, self.type.type))<EOL><DEDENT>else: self.difficulty = c.ComputerDifficulties(None)<EOL>
update attributes initialized with the proper type