def _savepath(self, filename):
(basename, ext) = os.path.splitext(filename)<EOL>basename = basename if (ext in self.extensions) else filename<EOL>ext = ext if (ext in self.extensions) else self.extensions[<NUM_LIT:0>]<EOL>savepath = os.path.abspath(os.path.join(self.directory,<EOL>'<STR_LIT>' % (basename, ext)))<EOL>return (tempfile.mkstemp(ext, basename + "<STR_LIT:_>", self.directory)[<NUM_LIT:1>]<EOL>if self.hash_suffix else savepath)<EOL>
Returns the full path for saving the file, adding an extension
and making the filename unique as necessary.