A few python database helper functions