def clean_slashes(path):
 return (path.strip(u'/') if settings.APPEND_SLASH else path.lstrip(u'/'))

def clean_slashes ( path ) : return ( path . strip ( u'/' ) if settings . APPEND_SLASH else path . lstrip ( u'/' ) )
canonicalize path by removing leading slashes and conditionally removing trailing slashes .