The function adds or updates a key-value pair in the given dictionary. If the dictionary contains a pair with the key part equivalent to the given one then old value is replaced with a new one. Otherwise, a new pair is added to the dictionary.
The function returns the total number of pairs stored in the dictionary as counted after the modification.