def METHOD_NAME(
    self,
    host,
    port=1883,
    client_id="",
    username="",
    password="",
    keepalive=60,
    clean_session=True,
):
    """Connect to an MQTT broker. This is a pre-requisite step for publish
    and subscribe keywords.
    `host` MQTT broker host
    `port` broker port (default 1883)
    `client_id` if not specified, a random id is generated
    `username` user name, default to ""
    `password` user password, default to ""
    `keepalive` keepalive in seconds
    `clean_session` specifies the clean session flag for the connection
    Examples:
    Connect to a broker with default port and client id
    | Connect | 127.0.0.1 |
    Connect to a broker by specifying the port and client id explicitly
    | Connect | 127.0.0.1 | 1883 | test.client |
    Connect to a broker with clean session flag set to false
    | Connect | 127.0.0.1 | clean_session=${false} |
    """
    client = MQTTClient(client_id, clean_session=clean_session)
    client.on_connect = self._on_connect
    client.on_message = self._on_message
    client.on_disconnect = self._on_disconnect
    client.on_subscribe = self._on_subscribe
    client.on_unsubscribe = self._on_unsubscribe
    client.set_config(
        {
            "reconnect_retries": self._reconnect_retries,
            "reconnect_delay": self._reconnect_delay,
        }
    )
    self._client = client
    self._run(self._client.METHOD_NAME(host, port, version=MQTTv311))