<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __symlink_dir(self, dir_name, name, path):
 """ Symlink an object at path to name in the dir_name folder. remove it if it already exists. """

        target_dir = os.path.join(self.root_dir, dir_name)
        if not os.path.exists(target_dir):
            os.makedirs(target_dir)
        target_path = os.path.join(self.root_dir, dir_name, name)
        logger.debug("Attempting to symlink %s to %s..." % (path, target_path))
        if os.path.exists(target_path):
            if os.path.islink(target_path):
                os.remove(target_path)
            else:
                logger.warn("%s is not a symlink! please remove it manually." % target_path)
                return
        os.symlink(path, target_path)