This is a precarious thing, since twisted reports session addresses a little differently depending on if it is a telnet or a html/comet or ssh/ssl connection connecting. Some of the syntax has a tuple you need to extract, some has just the IP as a string. It should probably be homogenized on the Protocol level though, not here, so keeping your change.