def METHOD_NAME(self):
    """Handle a disconnect."""
    self.disconnected = True
    if self.ws is not None:
        # Close connection
        self.ws.close()
    elif not self.ws_future.done():
        # Cancel pending connection.  Since future.cancel() is a noop on tornado, we'll track cancellation locally
        self.ws_future.cancel()
        self.log.debug(f"_disconnect: future cancelled, disconnected: {self.disconnected}")