def path_join_secure(base, *paths):
    base = os.path.abspath(base)
    if not base.endswith(os.path.sep):
        base = base + os.path.sep

    path = os.path.abspath(os.path.join(base, *paths))
    if not path.startswith(base):
        raise ValueError("Resulting path %r is outside %r." % (path, base))
    return path
Join two or more pathname components, inserting slashes as needed.
dataset/ETHPy150Open scrapinghub/splash/splash/utils.py/path_join_secure