def diff_counts_dict(fp1, fp2, only_positive=False):
    """Given two fingerprints, returns difference of their counts dicts.

    Parameters
    ----------
    fp1, fp2 : Fingerprint
        `Fingerprint` objects, `fp2` subtracted from `fp1`.
    only_positive : bool, optional
        Return only positive counts, negative being thresholded to 0.

    Returns
    -------
    counts_diff : dict
        Count indices in either `fp1` or `fp2` with value as diff of counts.

    See Also
    --------
    sum_counts_dict
    """
    counts_diff = fp1.counts.copy()
    for k, v in fp2.counts.items():
        counts_diff[k] = counts_diff.get(k, 0) - v
        if only_positive and counts_diff[k] < 0:
            del counts_diff[k]
    return counts_diff
