def gen_replacement_dict(old_config, new_config):
    """Create a pymatgen replacement dict based on old and new sublattice configurations.

    Shapes of the config lists must match.

    Parameters
    ----------
    old_config : list
        DFTTK style configuration that will be replaced
    new_config : list
        DFTTK style configuration that the new structure will have

    Returns
    -------
    dict
        Dict of {element_to_replace: new_element}
    """
    replacement_dict = {}
    for new_subl, old_subl in zip(new_config, old_config):
        for new_atom, old_atom in zip(new_subl, old_subl):
            replacement_dict[old_atom] = new_atom
    return replacement_dict