def stat(path, user=None):
    """
    Performs the equivalent of :func:`os.stat` on ``path``, returning a
    :class:`StatResult` object.
    """
    host, port, path_ = split(path, user)
    fs = hdfs_fs.hdfs(host, port, user)
    retval = StatResult(fs.get_path_info(path_))
    if not host:
        _update_stat(retval, path_)
    fs.close()
    return retval