def arrswapmid(data):
 assert ((len(data) % 2) == 0)
 ret = ([''] * len(data))
 ret[1::2] = data[0::2]
 ret[0::2] = data[1::2]
 return ret

def arrswapmid ( data ) : assert ( ( len ( data ) % 2 ) == 0 ) ret = ( [ '' ] * len ( data ) ) ret [ 1 : : 2 ] = data [ 0 : : 2 ] ret [ 0 : : 2 ] = data [ 1 : : 2 ] return ret
convert an array of characters from middle-endian to big-endian and vice-versa .