[python] How can I debug what is causing a connection refused or a connection time out?