def _makedirs(self, path):
        """Make folders recursively for the given path and
           check read and write permission on the path
          Args:
            path -- path to the leaf folder
        """
        try:
            oldmask = os.umask(0)
            os.makedirs(path, self._conf['dmode'])
            os.umask(oldmask)
        except OSError as e:
            if(e.errno == errno.EACCES):
                raise Exception('not sufficent permissions to write on fsdb folder: "{0}"'.format(path))
            elif(e.errno == errno.EEXIST):
                fstat = os.stat(path)
                if not stat.S_ISDIR(fstat.st_mode):
                    raise Exception('fsdb folder already exists but it is not a regular folder: "{0}"'.format(path))
                elif not os.access(path, os.R_OK and os.W_OK):
                    raise Exception('not sufficent permissions to write on fsdb folder: "{0}"'.format(path))
            else:
                raise e