human
Complete this python program:
def fsn2uri(path):
assistant
#Here is the Python program you requested.

    """Args:
    path (fsnative): The path to convert to an URI
    Returns:
    `text`: An ASCII only URI
    Raises:
    TypeError: If no `fsnative` was passed
    ValueError: If the path can\t be converted
    Takes a `fsnative` path and returns a file URI.
    On Windows non-ASCII characters will be encoded using utf-8 and then
    percent encoded.
    """
    path = _fsn2native(path)
    def _quote_path(path):
        path = quote(path, '/:@&=+$,')
        if PY2:
            path = path.decode('ascii')
        return path
    if is_win:
        buf = ctypes.create_unicode_buffer(winapi.INTERNET_MAX_URL_LENGTH)
        length = winapi.DWORD(winapi.INTERNET_MAX_URL_LENGTH)
        flags = 0
        try:
            winapi.UrlCreateFromPathW(path, buf, ctypes.byref(length), flags)
        except WindowsError as e:
            raise ValueError(e)
        uri = buf[:length.value]
        if PY3:
            uri = unquote(uri, 'latin-1')
        else:
            uri = unquote(uri)
        return _quote_path(uri.encode('utf-8', _surrogatepass))
    else:
        return (u'file://' + _quote_path(path))