<s> """<STR_LIT>""" <EOL> def MonkeyPatch ( cls , method_name , method ) : <EOL> try : <EOL> return getattr ( cls , method_name ) <EOL> except AttributeError : <EOL> setattr ( cls , method_name , method ) <EOL> return method <EOL> try : <EOL> from google . protobuf import message <EOL> def Message__getstate__ ( self ) : <EOL> """<STR_LIT>""" <EOL> return dict ( serialized = self . SerializePartialToString ( ) ) <EOL> def Message__setstate__ ( self , state ) : <EOL> """<STR_LIT>""" <EOL> self . __init__ ( ) <EOL> self . ParseFromString ( state [ "<STR_LIT>" ] ) <EOL> MonkeyPatch ( message . Message , "<STR_LIT>" , Message__getstate__ ) <EOL> MonkeyPatch ( message . Message , "<STR_LIT>" , Message__setstate__ ) <EOL> except ImportError : <EOL> pass </s>
