Return the real wanted path (relative to the INGInious root) or None if the path is not valid/allowed

def verify_path(self, courseid, taskid, path, new_path=False):
        """ Return the real wanted path (relative to the INGInious root) or None if the path is not valid/allowed """
        task_fs = self.task_factory.get_task_fs(courseid, taskid)
        # verify that the dir exists
        if not task_fs.exists():
            return None

        # all path given to this part of the application must start with a "/", let's remove it
        if not path.startswith("/"):
            return None
        path = path[1:len(path)]

        if ".." in path:
            return None

        if task_fs.exists(path) == new_path:
            return None

        # do not allow touching the task.* file
        if os.path.splitext(path)[0] == "task" and os.path.splitext(path)[1][1:] in \
                self.task_factory.get_available_task_file_extensions():
            return None

        # do not allow hidden dir/files
        if path != ".":
            for i in path.split(os.path.sep):
                if i.startswith("."):
                    return None
        return path