Clone `db_to_clone` into DATABASES['default']

def clone_psql_db(db_to_clone):
    """Clone `db_to_clone` into DATABASES['default']"""
    # If db_to_clone is a path, assume it is a SQL dump...
    if os.path.isfile(db_to_clone):
        logger.info("Treating %s as a path to a SQL dump", repr(db_to_clone))
        # ...and use it to populate our database
        populate_db(db_to_clone)
    # Otherwise, assume it is a database name...
    else:
        logger.info("Treating %s as a database name", repr(db_to_clone))
        # ...create a temp file to dump it into...
        with NamedTemporaryFile(prefix="{}.sql.".format(db_to_clone)) as backup_file:
            # ...perform the dump...
            pg_dump(db_to_clone, backup_file.name)
            # ...and load the contents of the dump into our DB
            populate_db(backup_file.name)