Create SQLite backups I have this script for creating SQLite backups, and I was wondering whether you'd have any suggestions on how to improve this. I was thinking that maybe it should create the backup dir if it doesn't exist, but not sure if it's necessarily better.
Besides functionality/performance tips, any styling/formatting tips are also much appreciated.
#!/usr/bin/env python
&quot;&quot;&quot;
This script creates a timestamped database backup,
and cleans backups older than a set number of dates

&quot;&quot;&quot;    

from __future__ import print_function
from __future__ import unicode_literals

import argparse
import sqlite3
import shutil
import time
import os

DESCRIPTION = &quot;&quot;&quot;
              Create a timestamped SQLite database backup, and
              clean backups older than a defined number of days
              &quot;&quot;&quot;

# How old a file needs to be in order
# to be considered for being removed
NO_OF_DAYS = 7

def sqlite3_backup(dbfile, backupdir):
    &quot;&quot;&quot;Create timestamped database copy&quot;&quot;&quot;

    if not os.path.isdir(backupdir):
        raise Exception(&quot;Backup directory does not exist: {}&quot;.format(backupdir))

    backup_file = os.path.join(backupdir, os.path.basename(dbfile) +
                               time.strftime(&quot;-%Y%m%d-%H%M%S&quot;))

    connection = sqlite3.connect(dbfile)
    cursor = connection.cursor()

    # Lock database before making a backup
    cursor.execute('begin immediate')
    # Make new backup file
    shutil.copyfile(dbfile, backup_file)
    print (&quot;\nCreating {}...&quot;.format(backup_file))
    # Unlock database
    connection.rollback()

def clean_data(backup_dir):
    &quot;&quot;&quot;Delete files older than NO_OF_DAYS days&quot;&quot;&quot;

    print (&quot;\n------------------------------&quot;)
    print (&quot;Cleaning up old backups&quot;)

    for filename in os.listdir(backup_dir):
        backup_file = os.path.join(backup_dir, filename)
        if os.stat(backup_file).st_ctime &lt; (time.time() - NO_OF_DAYS * 86400):
            if os.path.isfile(backup_file):
                os.remove(backup_file)
                print (&quot;Deleting {}...&quot;.format(ibackup_file))

def get_arguments():
    &quot;&quot;&quot;Parse the commandline arguments from the user&quot;&quot;&quot;

    parser = argparse.ArgumentParser(description=DESCRIPTION)
    parser.add_argument('db_file',
                        help='the database file that needs backed up')
    parser.add_argument('backup_dir',
                         help='the directory where the backup'
                              'file should be saved')
    return parser.parse_args()

if __name__ == &quot;__main__&quot;:
    args = get_arguments()
    sqlite3_backup(args.db_file, args.backup_dir)
    clean_data(args.backup_dir)

    print (&quot;\nBackup update has been successful.&quot;)

Note: Code works in both Python 2 and Python 3.
There's no need to repeat yourself by defining DESCRIPTION (and in fact your strings have gotten out of sync).  Just reuse the program's docstring:

def get_arguments():
    """Parse the commandline arguments from the user"""    
    parser = argparse.ArgumentParser(description=__doc__)
    …