def getpeername(self, socket): if not isinstance(socket, tco.TransmissionControlObject): raise err.Error(errno.ENOTSOCK) return socket.peer