Testing BSD sockets in Python