def get_path_prefix(path, pwd=None):
    'Get path prefix (for current directory)\n\n    Returns relative path to the topdir, if we are under topdir, and if not\n    absolute path to topdir.  If `pwd` is not specified - current directory\n    assumed\n    '
    pwd = (pwd or getpwd())
    path = dlabspath(path)
    path_ = with_pathsep(path)
    pwd_ = with_pathsep(pwd)
    common = commonprefix((path_, pwd_))
    if (common.endswith(sep) and (common in {path_, pwd_})):
        location_prefix = relpath(path, pwd)
        if (location_prefix in (curdir, (curdir + sep))):
            location_prefix = ''
        return location_prefix
    else:
        return path
Get path prefix (for current directory)

Returns relative path to the topdir, if we are under topdir, and if not
absolute path to topdir.  If `pwd` is not specified - current directory
assumed
def get_path_prefix(path, pwd=None):
    'Get path prefix (for current directory)\n\n    Returns relative path to the topdir, if we are under topdir, and if not\n    absolute path to topdir.  If `pwd` is not specified - current directory\n    assumed\n    '
    pwd = (pwd or getpwd())
    path = dlabspath(path)
    path_ = with_pathsep(path)
    pwd_ = with_pathsep(pwd)
    common = commonprefix((path_, pwd_))
    if (common.endswith(sep) and (common in {path_, pwd_})):
        location_prefix = relpath(path, pwd)
        if (location_prefix in (curdir, (curdir + sep))):
            location_prefix = 
        return location_prefix
    else:
        return path