# Buggy code
def _parse_uri(uri_as_string):
    """
    Parse the given URI from a string.

    Supported URI schemes are:

      * file
      * hdfs
      * http
      * https
      * s3
      * s3a
      * s3n
      * s3u
      * webhdfs

    .s3, s3a and s3n are treated the same way.  s3u is s3 but without SSL.

    Valid URI examples::

      * s3://my_bucket/my_key
      * s3://my_key:my_secret@my_bucket/my_key
      * s3://my_key:my_secret@my_server:my_port@my_bucket/my_key
      * hdfs:///path/file
      * hdfs://path/file
      * webhdfs://host:port/path/file
      * ./local/path/file
      * ~/local/path/file
      * local/path/file
      * ./local/path/file.gz
      * file:///home/user/file
      * file:///home/user/file.bz2
    """
    if os.name == "nt":
        # urlsplit doesn't work on Windows -- it parses the drive as the scheme...
        if "://" not in uri_as_string:
            # no protocol given => assume a local file
            uri_as_string = "file://" + uri_as_string
    parsed_uri = urlsplit(uri_as_string, allow_fragments=False)

    if parsed_uri.scheme == "hdfs":
        return _parse_uri_hdfs(parsed_uri)
    elif parsed_uri.scheme == "webhdfs":
        return _parse_uri_webhdfs(parsed_uri)
    elif parsed_uri.scheme in smart_open_s3.SUPPORTED_SCHEMES:
        return _parse_uri_s3x(parsed_uri)
    elif parsed_uri.scheme in ("file", "", None):
        return _parse_uri_file(parsed_uri)
    elif parsed_uri.scheme.startswith("http"):
        return Uri(scheme=parsed_uri.scheme, uri_path=uri_as_string)
    else:
        raise NotImplementedError(
            "unknown URI scheme %r in %r" % (parsed_uri.scheme, uri_as_string)
        )


# Traceback (FileNotFoundError)
smart_open.smart_open('//anaconda/envs/python3/lib/python3.5/site-packages/gensim/test/test_data/lee_background.cor','r')
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-12-6a05871c0775> in <module>()
----> 1 smart_open.smart_open('//anaconda/envs/python3/lib/python3.5/site-packages/gensim/test/test_data/lee_background.cor','r')

//anaconda/envs/python3/lib/python3.5/site-packages/smart_open/smart_open_lib.py in smart_open(uri, mode, **kw)
138             # local files -- both read &amp; write supported
139             # compression, if any, is determined by the filename extension (.gz, .bz2)
--> 140             return file_smart_open(parsed_uri.uri_path, mode)
141         elif parsed_uri.scheme in ("s3", "s3n", "s3u"):
142             kwargs = {}

//anaconda/envs/python3/lib/python3.5/site-packages/smart_open/smart_open_lib.py in file_smart_open(fname, mode)
642
643     """
--> 644     return compression_wrapper(open(fname, mode), fname, mode)
645
646

FileNotFoundError: [Errno 2] No such file or directory: 'anaconda/envs/python3/lib/python3.5/site-packages/gensim/test/test_data/lee_background.cor'

# Fixed code
def _parse_uri(uri_as_string):
    """
    Parse the given URI from a string.

    Supported URI schemes are:

      * file
      * hdfs
      * http
      * https
      * s3
      * s3a
      * s3n
      * s3u
      * webhdfs

    .s3, s3a and s3n are treated the same way.  s3u is s3 but without SSL.

    Valid URI examples::

      * s3://my_bucket/my_key
      * s3://my_key:my_secret@my_bucket/my_key
      * s3://my_key:my_secret@my_server:my_port@my_bucket/my_key
      * hdfs:///path/file
      * hdfs://path/file
      * webhdfs://host:port/path/file
      * ./local/path/file
      * ~/local/path/file
      * local/path/file
      * ./local/path/file.gz
      * file:///home/user/file
      * file:///home/user/file.bz2
    """
    if os.name == "nt":
        # urlsplit doesn't work on Windows -- it parses the drive as the scheme...
        if "://" not in uri_as_string:
            # no protocol given => assume a local file
            uri_as_string = "file://" + uri_as_string
    parsed_uri = urlsplit(uri_as_string, allow_fragments=False)

    if parsed_uri.scheme == "hdfs":
        return _parse_uri_hdfs(parsed_uri)
    elif parsed_uri.scheme == "webhdfs":
        return _parse_uri_webhdfs(parsed_uri)
    elif parsed_uri.scheme in smart_open_s3.SUPPORTED_SCHEMES:
        return _parse_uri_s3x(parsed_uri)
    elif parsed_uri.scheme == "file":
        return _parse_uri_file(parsed_uri.netloc + parsed_uri.path)
    elif parsed_uri.scheme in ("", None):
        return _parse_uri_file(uri_as_string)
    elif parsed_uri.scheme.startswith("http"):
        return Uri(scheme=parsed_uri.scheme, uri_path=uri_as_string)
    else:
        raise NotImplementedError(
            "unknown URI scheme %r in %r" % (parsed_uri.scheme, uri_as_string)
        )