'We keep old master key files around for up to 5 days, so users can
revert if they make some sort of horrible mistake. After that we
delete the backups because they\'re technically a security risk.'

def _delete_old_master_keys(self, keyfile):

    maxage = (time.time() - ((5 * 24) * 3600))
    prefix = (os.path.basename(keyfile) + '.')
    dirname = os.path.dirname(keyfile)
    for f in os.listdir(dirname):
        fn = os.path.join(dirname, f)
        if (f.startswith(prefix) and (os.stat(fn).st_mtime < maxage)):
            safe_remove(fn)
