completed db.py