code: def is_connected(self):
          
          try:
              return self.socket is not None and self.socket.getsockname()[1] != 0 and BaseTransport.is_connected(self)
          except socket.error:
              return False
docs: Return true if the socket managed by this connection is connected
  
          :rtype: bool