def auth_params(mqtt_config):
    """Return the authentication parameters from a :class:`.MQTTConfig`
    object.

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

    Returns:
        dict: A dict {'username': username, 'password': password} with the
        authentication parameters, or None if no authentication is used.

    .. versionadded:: 0.6.0
    """
    # Set up a dict containing authentication parameters for the MQTT client.
    if mqtt_config.auth.username:
        # The password can be None.
        return {'username': mqtt_config.auth.username,
                'password': mqtt_config.auth.password}
    # Or use no authentication.
    else:
        return None