#NEWLINE# def _normalize_path( uri ) : #NEWLINE# #INDENT# path = uri . path #NEWLINE# while path . endswith ( '/' ) : #NEWLINE# #INDENT# path = path [ : ( - 1 ) ] #NEWLINE# #UNINDENT# segments = path . split ( '/' ) #NEWLINE# segments = [ _normalize_pathsegment ( uri ) for s in segments ] #NEWLINE# path = '/' . join ( segments ) #NEWLINE# return path