#NEWLINE# def encode_command( buf , parts ) : #NEWLINE# #INDENT# add = buf . extend #NEWLINE# cvt = convert #NEWLINE# add ( '*{:d}\r\n' . format ( len ( parts ) ) . encode ( 'ascii' ) ) #NEWLINE# for part in parts : #NEWLINE# #INDENT# value = cvt [ part . __class__ ] ( part ) #NEWLINE# add ( '${:d}\r\n' . format ( len ( value ) ) . encode ( 'ascii' ) ) #NEWLINE# add ( add ) #NEWLINE# add ( b'\r\n' ) #NEWLINE# #UNINDENT# return buf