'Securely destroy a decrypted file
Note standard limitations of GNU shred apply (For flash, overwriting would have no effect
due to wear leveling; for other storage systems, the async kernel->filesystem->disk calls never
guarantee data hits the disk; etc). Furthermore, if your tmp dirs is on tmpfs (ramdisks),
it is a non-issue.
Nevertheless, some form of overwriting the data (instead of just removing the fs index entry) is
a good idea. If shred is not available (e.g. on windows, or no core-utils installed), fall back on
a custom shredding method.'

def _shred_file(self, tmp_path):

    if (not os.path.isfile(tmp_path)):
        return
    try:
        r = subprocess.call(['shred', tmp_path])
    except (OSError, ValueError):
        r = 1
    if (r != 0):
        self._shred_file_custom(tmp_path)
    os.remove(tmp_path)
