#NEWLINE# def write_packet( self , packet , force = False ) : #NEWLINE# #INDENT# "Writes a packet to the server.\n\n        If force is set to true, the method attempts to acquire the write lock\n        and write the packet out immediately, and as such may block.\n\n        If force is false then the packet will be added to the end of the\n        packet writing queue to be sent 'as soon as possible'\n\n        :param packet: The :class:`network.packets.Packet` to write\n        :param force(bool): Specifies if the packet write should be immediate\n        " #NEWLINE# if force : #NEWLINE# #INDENT# self . _write_lock . acquire ( ) #NEWLINE# if self . options . compression_enabled : #NEWLINE# #INDENT# packet . write ( self . socket , self . options . compression_threshold ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# packet . write ( self . socket ) #NEWLINE# #UNINDENT# self . _write_lock . release ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _outgoing_packet_queue . append ( packet )