'return a string which is a relative path from self
(assumed to be a directory) to dest such that
self.join(bestrelpath) == dest and if not such
path can be determined return dest.'

def bestrelpath(self, dest):

    try:
        if (self == dest):
            return os.curdir
        base = self.common(dest)
        if (not base):
            return str(dest)
        self2base = self.relto(base)
        reldest = dest.relto(base)
        if self2base:
            n = (self2base.count(self.sep) + 1)
        else:
            n = 0
        l = ([os.pardir] * n)
        if reldest:
            l.append(reldest)
        target = dest.sep.join(l)
        return target
    except AttributeError:
        return str(dest)
