def modify(node):
    """
    Modify the branch to NODE, if NODE is a terminal node and the `division_exposure`
    of NODE differs from the `division`.
    This creates an intermediate branch, with a single child, such that we have
    PARENT-INTERMEDIATE-NODE.
    """
    if "children" in node:
        return node
    division = node["node_attrs"].get("division", {}).get("value", "")
    recoded = node["node_attrs"].get("division_exposure", {}).get("value", "")
    if not division or not recoded or division == recoded:
        return node


    ## Make a new node which is the INTERMEDIATE (i.e. a single child, which is `node` with slight modifications)
    n = {
        "name": node["name"]+"_travel_history",
        "node_attrs": {
            "div": node["node_attrs"]["div"],
            "num_date": node["node_attrs"]["num_date"],
            "division_exposure": node["node_attrs"]["division_exposure"]
        },
        "children": [node]
    }

    # Story a backup of the original exposure, to put back in later
    node["node_attrs"]["division_exposure_backup"] = node["node_attrs"]["division_exposure"]
    # change actual NODE division_exposure to have collection division
    node["node_attrs"]["division_exposure"] = node["node_attrs"]["division"]
    return n