def endian_swap_words(source):
 assert ((len(source) % 4) == 0)
 words = ('I' * (len(source) // 4))
 return struct.pack(('<' + words), *struct.unpack(('>' + words), source))

def endian_swap_words ( source ) : assert ( ( len ( source ) % 4 ) == 0 ) words = ( 'I' * ( len ( source ) // 4 ) ) return struct . pack ( ( '<' + words ) , * struct . unpack ( ( '>' + words ) , source ) )
endian-swap each word in source bitstring .