def dict_pathsearch(dict, path):
    """
    Finds a value inside a dictionary of dictionaries given a path-like string
    of keys separated by periods. Raises KeyError if the requested path
    doesn't exist.
    
    Example
    -------
    
    Given a dictionary like the following:
    
    {
        foo : "foo"
        bar : "bar"
        baz : {
            bling: "bling"
            spam: {
                eggs: "eggs"
                ham: "ham"
            }
        } 
    }
    
    and a path like:
    
    dict_pathsearch(dict, "baz.spam.ham") returns "ham"
    dict_pathsearch(dict, "foo") returns "foo"
    dict_pathsearch(dict, "baz.bling") returns "bling"
    dict_pathsearch(dict, "python") raises KeyError
    """
    pathchunks = path.split('.')
    current = dict
    for chunk in pathchunks:
        if chunk in current:
            current = current[chunk]
        else:
            raise KeyError
    return current