from typing import Dict


def _add_dictionaries(
    dict_a: Dict[str, float], dict_b: Dict[str, float]
) -> Dict[str, float]:
    """
    Adds together two dictionaries of radionuclides and associated activities.

    Parameters
    ----------
    dict_a : dict
        First dictionary containing radionuclide strings as keys and activities as values.
    dict_b : dict
        Second dictionary containing radionuclide strings as keys and activities as values.

    Returns
    -------
    dict
        Combined dictionary containing the radionuclides in both dict_a and dict_b, where
        activities have been added together when a radionuclide is present in both input
        dictionaries.

    Examples
    --------
    >>> dict_a = {'Pm-141': 1.0, 'Rb-78': 2.0}
    >>> dict_b = {'Pm-141': 3.0, 'Rb-90': 4.0}
    >>> rd.inventory._add_dictionaries(dict_a, dict_b)
    {'Pm-141': 4.0, 'Rb-78': 2.0, 'Rb-90': 4.0}

    """

    new_dict = dict_a.copy()
    for radionuclide, radioactivity in dict_b.items():
        if radionuclide in new_dict:
            new_dict[radionuclide] = new_dict[radionuclide] + radioactivity
        else:
            new_dict[radionuclide] = radioactivity

    return new_dict