<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rename(self, old, new):
 """ Directory renaming support. Needed because many file managers create directories with default names, wich makes it impossible to perform a search without CLI. Name changes for files are not allowed, only for directories. Parameters old : str Old name. Converted to tuple identifier by ``_pathdec`` decorator. new : str New name. Converted to tuple identifier in actual function body. """


        new = self.__pathToTuple(new)

        if not self.__exists(old):
            raise FuseOSError(errno.ENOENT)

        if self.PathType.get(old) is not self.PathType.subdir or self.PathType.get(new) is not self.PathType.subdir:
            raise FuseOSError(errno.EPERM)

        if self.__exists(new):
            raise FuseOSError(errno.EEXIST)

        try:
            new_dir_ent = YTActions(new[0])
            new_dir_ent.updateResults()
        except ConnectionError:
            raise FuseOSError(errno.ENETDOWN)

        self.searches[new[0]] = new_dir_ent # as in mkdir

        try:
            del self.searches[old[0]]

        except KeyError:
            raise FuseOSError(errno.ENOENT)

        return 0