<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect(self, host="localhost", port=1883, keepalive=60):
 """ Connects to the MQTT server. The client will automatically try to reconnect to this server when the connection is lost. :param host: MQTT server host :param port: MQTT server port :param keepalive: Maximum period in seconds between communications with the broker :raise ValueError: Invalid host or port """

        # Disconnect first (it also stops the timer)
        self.disconnect()

        # Prepare the connection
        self.__mqtt.connect(host, port, keepalive)

        # Start the MQTT loop
        self.__mqtt.loop_start()