#NEWLINE# def begin( self , transaction = None , headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , **keyword_headers ) : #NEWLINE# #INDENT# '\n        Begin a transaction.\n\n        :param transaction: the identifier for the transaction (optional - if not specified\n            a unique transaction id will be generated)\n        :param headers: a map of any additional headers the broker requires\n        :param keyword_headers: any additional headers the broker requires\n\n        :return: the transaction id\n        ' #NEWLINE# headers = utils . merge_headers ( [ headers , keyword_headers ] ) #NEWLINE# if ( not transaction ) : #NEWLINE# #INDENT# transaction = str ( uuid . uuid4 ( ) ) #NEWLINE# #UNINDENT# headers [ HDR_TRANSACTION ] = self #NEWLINE# self . send_frame ( CMD_BEGIN , headers ) #NEWLINE# return transaction