def get_deep(x, path, default=None):
    """ access value of a multi-level dict in one go.
    :param x: a multi-level dict
    :param path: a path to desired key in dict
    :param default: a default value to return if no value at path

    Examples:
    x = {'a': {'b': 5}}
    get_deep(x, 'a.b') returns 5
    get_deep(x, ['a', 'b']) returns 5
    get_deep(x, 'c', 5) returns 5
    """
    if path is None or path == '':
        path_keys = []
    elif type(path) in (list, tuple):
        path_keys = path
    else:
        path_keys = path.split('.')

    v = x or {}
    for k in path_keys:
        try:
            v = v.get(k)
        except TypeError:
            v = None
        finally:
            if v is None:
                return default
    return v