code: def filepath_to_uri(path):
      
      if path is None:
          return path
      # I know about `os.sep` and `os.altsep` but I want to leave
      # some flexibility for hardcoding separators.
      return quote(force_bytes(path).replace(b"\\", b"/"), safe=b"/~!*()'")
docs: Convert a file system path to a URI portion that is suitable for
      inclusion in a URL.
  
      We are assuming input is either UTF-8 or unicode already.
  
      This method will encode certain chars that would normally be recognized as
      special chars for URIs.  Note that this method does not encode the '
      character, as it is a valid character within URIs.  See
      encodeURIComponent() JavaScript function for more details.
  
      Returns an ASCII string containing the encoded result.