#NEWLINE# def write_varint( trans , n ) : #NEWLINE# #INDENT# out = [ ] #NEWLINE# while True : #NEWLINE# #INDENT# if ( ( n & ( ~ 127 ) ) == 0 ) : #NEWLINE# #INDENT# out . append ( n ) #NEWLINE# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# out . append ( ( ( n & 255 ) | 128 ) ) #NEWLINE# n = ( n >> 7 ) #NEWLINE# #UNINDENT# #UNINDENT# data = array . array ( 'B' , out ) . tostring ( ) #NEWLINE# if PY3 : #NEWLINE# #INDENT# trans . write ( data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# trans . write ( bytes ( n ) )