#NEWLINE# def getBytesForString( self , u ) : #NEWLINE# #INDENT# '\n        Returns the corresponding utf-8 encoded string for a given unicode\n        object. If there is no string, one is encoded.\n\n        @since: 0.6\n        ' #NEWLINE# h = hash ( u ) #NEWLINE# s = self . _unicodes . get ( h , None ) #NEWLINE# if ( s is not None ) : #NEWLINE# #INDENT# return s #NEWLINE# #UNINDENT# s = self . _unicodes [ u ] = u . encode ( 'utf-8' ) #NEWLINE# return s