def normpath(path):
    """
    Normalize ``path``, collapsing redundant separators and up-level refs.
    """
    scheme, netloc, path_ = parse(path)
    return unparse(scheme, netloc, os.path.normpath(path_))