def tls_params(mqtt_config):
    """Return the TLS configuration parameters from a :class:`.MQTTConfig`
    object.

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

    Returns:
        dict: A dict {'ca_certs': ca_certs, 'certfile': certfile,
        'keyfile': keyfile} with the TLS configuration parameters, or None if
        no TLS connection is used.

    .. versionadded:: 0.6.0
    """
    # Set up a dict containing TLS configuration parameters for the MQTT
    # client.
    if mqtt_config.tls.hostname:
        return {'ca_certs': mqtt_config.tls.ca_file,
                'certfile': mqtt_config.tls.client_cert,
                'keyfile': mqtt_config.tls.client_key}
    # Or don't use TLS.
    else:
        return None