code: def backup_mediafiles(self):
          
          # Create file name
          extension = "tar%s" % ('.gz' if self.compress else '')
          filename = utils.filename_generate(extension,
                                             servername=self.servername,
                                             content_type=self.content_type)
          tarball = self._create_tar(filename)
          # Apply trans
          if self.encrypt:
              encrypted_file = utils.encrypt_file(tarball, filename)
              tarball, filename = encrypted_file
  
          self.logger.debug("Backup size: %s", utils.handle_size(tarball))
          # Store backup
          tarball.seek(0)
          if self.path is None:
              self.write_to_storage(tarball, filename)
          else:
              self.write_local_file(tarball, self.path)
docs: Create backup file and write it to storage.