<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rmdir(self, tid):
 """ Directory removal. ``YTActions`` object under `tid` is told to clean all data, and then it is deleted. Parameters tid : str Path to file. Original `path` argument is converted to tuple identifier by ``_pathdec`` decorator. """


        pt = self.PathType.get(tid)

        if pt is self.PathType.main:
            raise FuseOSError(errno.EINVAL)
        elif pt is not self.PathType.subdir:
            raise FuseOSError(errno.ENOTDIR)

        try:
            self.searches[tid[0]].clean()
            del self.searches[tid[0]]

        except KeyError:
            raise FuseOSError(errno.ENOENT)

        return 0