#NEWLINE# def wait_for_write( socket , timeout = None ) : #NEWLINE# #INDENT# 'Wait up to `timeout` seconds until `socket` is ready for writing.\n        ' #NEWLINE# if ( timeout is not None ) : #NEWLINE# #INDENT# timeout *= 1000 #NEWLINE# #UNINDENT# poll = select . poll ( ) #NEWLINE# poll . register ( socket , select . POLLOUT ) #NEWLINE# events = poll . poll ( timeout ) #NEWLINE# return bool ( events )