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
    """
    if mqtt_config.auth.username:
        return {'username': mqtt_config.auth.username, 'password':
            mqtt_config.auth.password}
    else:
        return None
