Code for working with SQLite databases in Python