def merge(base, obj, location=None):
    """
    merge is like XmrsPathNode.update() except it raises errors on
    unequal non-None values.
    """
    # pump object to it's location with dummy nodes
    while location:
        axis = location.pop()
        obj = XmrsPathNode(None, None, links={axis: obj})
    if base is None:
        return obj
    _merge(base, obj)
    # if isinstance(base, XmrsPath):
    #     base.calculate_metrics()
    return base