#NEWLINE# def SetItem( self , key , value , raise_on_error = True ) : #NEWLINE# #INDENT# "Alternative to __setitem__ that can ignore errors.\n\n    Sometimes we want to serialize a structure that contains some simple\n    objects, and some that can't be serialized.  This method gives the caller a\n    way to specify that they don't care about values that can't be\n    serialized.\n\n    Args:\n      key: dict key\n      value: dict value\n      raise_on_error: if True, raise if we can't serialize.  If False, set the\n        key to an error string.\n    " #NEWLINE# del self [ key ] #NEWLINE# self . dat . Append ( k = DataBlob ( ) . SetValue ( key , raise_on_error = raise_on_error ) , v = DataBlob ( ) . SetValue ( value , raise_on_error = raise_on_error ) )