def get_nested_plot_frame(obj, key_map, cached=False):
    """Extracts a single frame from a nested object.

    Replaces any HoloMap or DynamicMap in the nested data structure,
    with the item corresponding to the supplied key.

    Args:
        obj: Nested Dimensioned object
        key_map: Dictionary mapping between dimensions and key value
        cached: Whether to allow looking up key in cache

    Returns:
        Nested datastructure where maps are replaced with single frames
    """
    clone = obj.map(lambda x: x)

    # Ensure that DynamicMaps in the cloned frame have
    # identical callback inputs to allow memoization to work
    for it1, it2 in zip(obj.traverse(lambda x: x), clone.traverse(lambda x: x)):
        if isinstance(it1, DynamicMap):
            with disable_constant(it2.callback):
                it2.callback.inputs = it1.callback.inputs
    with item_check(False):
        return clone.map(lambda x: get_plot_frame(x, key_map, cached=cached),
                         [DynamicMap, HoloMap], clone=False)