def remove_root(name): path = pathlib.PurePosixPath(name) if path.is_absolute(): path = path.relative_to(path.root) return path