python: Release Python GIL while running libguestfs calls.
Release the Python global interpreter lock while running libguestfs
calls.
We don't release it around guestfs_create() because that is a short
call that just allocates memory. We do release it around
guestfs_close() since that is a potentially long-running (it can call
wait(2) amongst other things). We also release it around all the
other generated Python calls.
We don't yet support callbacks into Python code (ie. the new event
API). But when we do in future, we will need to also handle the GIL
around those callbacks.
This code is adapted from libvirt's python/typewrappers.h. Thanks to
Dan Berrange for showing us how to do this properly.