Create db.py

First attempt at an API.