Easy save of a file

def file_save(self, name, filename=None, folder="", keep_ext=True) -> bool:
        """ Easy save of a file """
        if name in self.files:
            file_object = self.files[name]
            clean_filename = secure_filename(file_object.filename)
            if filename is not None and keep_ext:
                clean_filename = filename + ".%s" % \
                    (clean_filename.rsplit('.', 1)[1].lower())
            elif filename is not None and not keep_ext:
                clean_filename = filename
            file_object.save(os.path.join(
                current_app.config['UPLOADS']['FOLDER'],
                folder, clean_filename))
        return None