def relpath(path, start=curdir):
if not path:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>start_list = [x for x in abspath(start).split(sep) if x]<EOL>path_list = [x for x in abspath(path).split(sep) if x]<EOL>i = len(commonprefix([start_list, path_list]))<EOL>rel_list = [pardir] * (len(start_list)-i) + path_list[i:]<EOL>if not rel_list:<EOL><INDENT>return curdir<EOL><DEDENT>return join(*rel_list)<EOL>
Return a relative version of a path