Added support for (optionally) bracketing calls with
Py_{BEGIN,END}_ALLOW_THREADS.
diff --git a/Tools/bgen/bgen/bgenGenerator.py b/Tools/bgen/bgen/bgenGenerator.py
index 0cf4002..7b54579 100644
--- a/Tools/bgen/bgen/bgenGenerator.py
+++ b/Tools/bgen/bgen/bgenGenerator.py
@@ -216,6 +216,12 @@
     def precheck(self):
         pass
 
+    def beginallowthreads(self):
+        pass
+        
+    def endallowthreads(self):
+        pass
+        
     def callit(self):
         args = ""
         s = "%s%s(" % (self.getrvforcallit(), self.callname)
@@ -226,8 +232,10 @@
             s = arg.passArgument()
             if args: s = sep + s
             args = args + s
+        self.beginallowthreads()
         Output("%s%s(%s);",
                self.getrvforcallit(), self.callname, args)
+        self.endallowthreads()
 
     def getrvforcallit(self):
         if self.rv: