def relativize_path(path, base, os_sep=os.sep):
if not check_base(path, base, os_sep):<EOL><INDENT>raise OutsideDirectoryBase("<STR_LIT>" % (path, base))<EOL><DEDENT>prefix_len = len(base)<EOL>if not base.endswith(os_sep):<EOL><INDENT>prefix_len += len(os_sep)<EOL><DEDENT>return path[prefix_len:]<EOL>
Make absolute path relative to an absolute base.

:param path: absolute path
:type path: str
:param base: absolute base path
:type base: str
:param os_sep: path component separator, defaults to current OS separator
:type os_sep: str
:return: relative path
:rtype: str or unicode
:raises OutsideDirectoryBase: if path is not below base