Return a value from nested dicts by the order of the given keys tuple.

    Parameters
    ----------
    key_tuple : tuple
        The keys to use for extraction, in order.
    dict_obj : dict
        The outer-most dict to extract from.
    default_value : object, default None
        The value to return when no matching nested value is found.

    Returns
    -------
    value : object
        The extracted value, if exists. Otherwise, the given default_value.

    Example
    -------
    >>> dict_obj = {'a': {'b': 7}}
    >>> safe_nested_val(('a', 'b'), dict_obj)
    7
    >>> safe_nested_val(('a', 'c'), dict_obj)

    >>> safe_nested_val(('a', 'c'), dict_obj, 5)
    5
    >>> safe_nested_val(('d'), dict_obj, 5)
    5

def safe_nested_val(key_tuple, dict_obj, default_value=None):
    """Return a value from nested dicts by the order of the given keys tuple.

    Parameters
    ----------
    key_tuple : tuple
        The keys to use for extraction, in order.
    dict_obj : dict
        The outer-most dict to extract from.
    default_value : object, default None
        The value to return when no matching nested value is found.

    Returns
    -------
    value : object
        The extracted value, if exists. Otherwise, the given default_value.

    Example
    -------
    >>> dict_obj = {'a': {'b': 7}}
    >>> safe_nested_val(('a', 'b'), dict_obj)
    7
    >>> safe_nested_val(('a', 'c'), dict_obj)

    >>> safe_nested_val(('a', 'c'), dict_obj, 5)
    5
    >>> safe_nested_val(('d'), dict_obj, 5)
    5
    """
    try:
        return get_nested_val(key_tuple, dict_obj)
    except (KeyError, IndexError, TypeError):
        return default_value