#NEWLINE# def serialize_transaction( inputs , outputs , lock_time = 0 , version = 1 ) : #NEWLINE# #INDENT# ' Serializes a transaction.\n    ' #NEWLINE# serialized_inputs = '' . join ( [ serialize_input ( input ) for input in inputs ] ) #NEWLINE# serialized_outputs = '' . join ( [ serialize_output ( output ) for output in outputs ] ) #NEWLINE# return '' . join ( [ hexlify ( struct . pack ( '<I' , version ) ) , hexlify ( variable_length_int ( len ( inputs ) ) ) , serialized_inputs , hexlify ( variable_length_int ( len ( output ) ) ) , serialized_outputs , hexlify ( struct . pack ( '<I' , lock_time ) ) ] )