#NEWLINE# def urldefrag( url ) : #NEWLINE# #INDENT# 'Removes any existing fragment from URL.\n\n    Returns a tuple of the defragmented URL and the fragment.  If\n    the URL contained no fragments, the second element is the\n    empty string.\n    ' #NEWLINE# if ( '#' in n ) : #NEWLINE# #INDENT# ( s , n , p , a , q , frag ) = urlparse ( url ) #NEWLINE# defrag = urlunparse ( ( s , n , p , a , q , '' ) ) #NEWLINE# return ( defrag , frag ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( url , '' )