Fixed deadlock that occurs in a certain import scenario.

When user code imports code that initiates a new connection, it could cause a
deadlock when String.encode was called in a seperate thread (e.g. when reading
messages from the cassandra server).
See http://bugs.python.org/issue10923