Writing Stored Procedures in Python