def prep_directory(self, target_dir):
        """
        Prepares a new directory to store the file at the provided path, if needed.
        """
        dirname = path.dirname(target_dir)
        if dirname:
            dirname = path.join(settings.BUILD_DIR, dirname)
            if not self.fs.exists(dirname):
                logger.debug("Creating directory at {}{}".format(self.fs_name, dirname))
                self.fs.makedirs(dirname)
Prepares a new directory to store the file at the provided path, if needed.