'Converts absolute path to chrooted path'

def abs2chroot(self, path, force=False):

    if (None == self.enabled):
        raise RuntimeError('SoftChroot    is    not    initialized')
    if (None == path):
        raise ValueError('path    is    empty')
    if (not self.enabled):
        return path
    if (path == self.chdir.rstrip(os.path.sep)):
        return '/'
    resulst = None
    if (not path.startswith(self.chdir)):
        if force:
            result = self.get_chroot()
        else:
            raise ValueError(("path    must    starts    with    'chdir':    %s" % path))
    else:
        l = (len(self.chdir) - 1)
        result = path[l:]
    return result
