def host_port(mqtt_config):
    """Return the host and port from a :class:`.MQTTConfig` object.

    Args:
        mqtt_config (:class:`.MQTTConfig`): The MQTT connection settings.

    Returns:
        (str, int): A tuple with the host and port defined in the MQTT
        connection settings.

    .. versionadded:: 0.6.0
    """
    host_port = mqtt_config.broker_address.split(':')
    if mqtt_config.tls.hostname:
        host = mqtt_config.tls.hostname
    else:
        host = host_port[0]
    port = int(host_port[1])
    return host, port
