import copy


def make_hist_context(hist, context):
    """Update *context* with the context
    of a :class:`.histogram` *hist*.

    Deep copy of updated context is returned.
    """
    all_context = copy.deepcopy(context)
    hist_context = {
        "histogram": {
            "dim": hist.dim,
            "nbins": hist.nbins,
            "ranges": hist.ranges
        }
    }
    all_context.update(hist_context)
    return all_context
    # return copy.deepcopy(all_context)