Set a value in a 'cascade' fashion for mongodb_host[key]

    Within 'mongodb', as a last resort, its hardcoded default value is going to
    be picked.

    :param key: key name
    :param default: default last resort value
    :param mongodb_host: mongodb 'host' entry
    :param mongodb_defaults: mongodb 'defaults' dict

def _set_mongodb_host_val(key, default, mongodb_host, mongodb_defaults):
    """
    Set a value in a 'cascade' fashion for mongodb_host[key]

    Within 'mongodb', as a last resort, its hardcoded default value is going to
    be picked.

    :param key: key name
    :param default: default last resort value
    :param mongodb_host: mongodb 'host' entry
    :param mongodb_defaults: mongodb 'defaults' dict
    """
    # If mongodb_host[key] is not already set, its value is going to be picked
    # from mongodb_defaults[key]
    if key not in mongodb_host:
        if key in mongodb_defaults:
            mongodb_host[key] = mongodb_defaults[key]
        else:
            # BUT, if also mongodb_defaults[key] doesn't exist
            # the value picked is going to be 'default' as last resort
            mongodb_host[key] = default
        if key != 'user_name' and key != 'password':
            log.msg_debug("Setting default '{key}'='{value}' "
                          .format(key=key, value=mongodb_host[key]))