def merge_list(master_dict, parts):
    """Given a dict and a list of elements, recursively create sub-dicts to represent each "row" """
    if parts:
        head = parts.pop(0)
        master_dict[head] = merge_list(master_dict.setdefault(head, dict()), parts)

    return master_dict