#NEWLINE# def terminal_unreserve( progress_obj , terminal_obj = None , verbose = 0 , identifier = None ) : #NEWLINE# #INDENT# ' Unregisters the terminal (stdout) for printing.\n    \n    an instance (progress_obj) can only unreserve the tty (terminal_obj) when it also reserved it\n    \n    see terminal_reserved for more information\n    \n    Returns\n    -------\n    None\n    ' #NEWLINE# if ( terminal_obj is None ) : #NEWLINE# #INDENT# terminal_obj = sys . stdout #NEWLINE# #UNINDENT# if ( identifier is None ) : #NEWLINE# #INDENT# identifier = '' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# identifier = ( identifier + ': ' ) #NEWLINE# #UNINDENT# po = TERMINAL_RESERVATION . get ( terminal_obj ) #NEWLINE# if ( po is None ) : #NEWLINE# #INDENT# if ( verbose > 1 ) : #NEWLINE# #INDENT# print ( '{}terminal {} was not reserved, nothing happens' . format ( identifier , terminal_obj ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( po is progress_obj ) : #NEWLINE# #INDENT# if ( verbose > 1 ) : #NEWLINE# #INDENT# print ( '{}terminal {} now unreserned' . format ( terminal_obj , terminal_obj ) ) #NEWLINE# #UNINDENT# del TERMINAL_RESERVATION [ terminal_obj ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( verbose > 1 ) : #NEWLINE# #INDENT# print ( '{}you {} can NOT unreserve terminal {} be cause it was reserved by {}' . format ( identifier , progress_obj , terminal_obj , po ) )