def max_counts(ng1, ng2):
    """
    Return a dicitonary of ngram counts such that
    each count is the greater of the two individual counts
    for each ngram in the input ngram count dictionaries
    /ng1/ and /ng2/.
    """
    ret = ng1.copy()
    for k, v in ng2.items():
        ret[k] = max(ret.get(k, 0), v)
    return ret