[Python-Dev] Making python C-api thread safe