def filepath_to_uri(path):
 if (path is None):
  return path
 return quote(force_bytes(path).replace('\\', '/'), safe="/~!*()'")

def filepath_to_uri ( path ) : if ( path is None ) : return path return quote ( force_bytes ( path ) . replace ( '\\' , '/' ) , safe = "/~!*()'" )
convert a file system path to a uri portion that is suitable for inclusion in a url .