#NEWLINE# @ synchronized ( 'lock' ) #NEWLINE# def close( self , reply_code = 0 , reply_text = '' , method_type = method_t ( 0 , 0 ) ) : #NEWLINE# #INDENT# 'Request a channel close\n\n        This method indicates that the sender wants to close the channel. This may be due to\n        internal conditions (e.g. a forced shut-down) or due to an error handling a specific method,\n        i.e. an exception When a close is due to an exception, the sender provides the class and\n        method id of the method which caused the exception.\n\n        :param reply_code: the reply code\n        :param reply_text: localized reply text\n        :param method_type: if close is triggered by a failing method, this is the method that\n            caused it\n        :type reply_code: int\n        :type reply_text: str\n        :type method_type: amqpy.spec.method_t\n        ' #NEWLINE# try : #NEWLINE# #INDENT# if ( ( not self . is_open ) or ( args . connection is None ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# args = AMQPWriter ( ) #NEWLINE# args . write_short ( reply_code ) #NEWLINE# args . write_shortstr ( reply_text ) #NEWLINE# args . write_short ( method_type . class_id ) #NEWLINE# args . write_short ( method_type . method_id ) #NEWLINE# self . _send_method ( Method ( spec . Channel . Close , args ) ) #NEWLINE# return self . wait_any ( [ spec . Channel . Close , spec . Channel . CloseOk ] ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# self . connection = None