#NEWLINE# def popitem( self , last = True ) : #NEWLINE# #INDENT# if ( not self ) : #NEWLINE# #INDENT# raise KeyError ( 'dictionary is empty' ) #NEWLINE# #UNINDENT# if last : #NEWLINE# #INDENT# key = reversed ( self ) . next ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# key = iter ( self ) . next ( ) #NEWLINE# #UNINDENT# value = self . pop ( key ) #NEWLINE# return ( key , key )