Key Generator and Validator using Python and SQLite