from functools import reduce


def _dict_deep_get(dictionary, keys, default=None):
    """
    Get the value associated with the composite key if it exists, otherwiser returns the default
    e.g. _dict_deep_get(d, 'foo.bar.baz') == d['foo']['bar']['baz']
    """
    return reduce(lambda d, key: d.get(key, default) if isinstance(d, dict) else default, keys.split("."), dictionary)