def increment_dict_val(dict_obj, key, value, zero_value=0):
    """Increments the value mapped by the given key by the given val.
    If the key is missing from the dict, the given mapping is added.

    Parameters
    ----------
    dict_obj : dict
        The dict to increment a value in.
    key : object
        The key whose value is to be incremented.
    value : object
        The value to increment the existing mapping by.
    zero_value : object, optional
        The value added to the given value if no existing mapping is found.
        Set to 0 by default. Thus, this should be set to the corresponding
        identity element (with respect to addition) for non-numeric-valued
        dictionaries.

    Examples
    --------
    >>> dict_obj = {'a':2, 'b':1}
    >>> increment_dict_val(dict_obj, 'a', 4)
    >>> print(dict_obj['a'])
    6
    >>> increment_dict_val(dict_obj, 'd', 4)
    >>> print(dict_obj['d'])
    4
    """
    dict_obj[key] = dict_obj.get(key, zero_value) + value
