try: # try to do some SQL except: # perform a database rollback (db.rollback() ?) # and then throw an error to the user else: # commit the transaction to the database and # confirm to the user that their work succeeded finally: # close the database connection