#NEWLINE# def _prepare_response( self , s , d , cluster_id = None ) : #NEWLINE# #INDENT# if isinstance ( self , dict ) : #NEWLINE# #INDENT# data = json . dumps ( d ) . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data = d . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# r = mock . create_autospec ( urllib3 . response . HTTPResponse ) ( ) #NEWLINE# r . status = s #NEWLINE# r . data = data #NEWLINE# r . getheader . return_value = ( cluster_id or 'abcd1234' ) #NEWLINE# return r