pypima/db.py: Clean up, documentation.

Not tested.