code: def shutdown(self):
          
          self._request_shutdown = True
          for i in range(100):
              if self._state == STATE_DISCONNECTED:
                  break
              time.sleep(0.1)
docs: Request the system to shutdown the main loop and shutdown the system
              This is a one-way trip! Reconnecting requires a new connection
              to be made!