#NEWLINE# def get_safe_local_id( url , index = '' , suffix = '.html' ) : #NEWLINE# #INDENT# parse_result = urlparse . urlparse ( url ) #NEWLINE# last_path = os . path . split ( parse_result . path ) [ 1 ] #NEWLINE# if ( last_path == '' ) : #NEWLINE# #INDENT# url_path = parse_result . path [ : ( - 1 ) ] #NEWLINE# last_path = os . path . split ( url_path ) [ 1 ] #NEWLINE# #UNINDENT# uid = ( ( ( ( last_path + '?' ) + parse_result . query ) + index ) + suffix ) #NEWLINE# uid = urllib . quote_plus ( uid ) #NEWLINE# return uid