from typing import List
from typing import Dict


def _sort_list_according_to_dataset(
    input_list: List[str], key_dict: Dict[str, int]
) -> List[str]:
    """
    Sorts a list of radionuclides based on their order of appearence in the decay dataset.

    Parameters
    ----------
    input_list : list
        List of radionuclide strings to be sorted.
    key_dict : dict
        Dictionary from the decay dataset with radionuclide strings as keys and their position
        (integers) in the decay dataset.

    Returns
    -------
    list
        Sorted radionuclide list.

    Examples
    --------
    >>> rd.inventory._sort_list_according_to_dataset(['Tc-99', 'Tc-99m'], rd.DEFAULTDATA.radionuclide_dict)
    ['Tc-99m', 'Tc-99']

    """

    return sorted(input_list, key=lambda radionuclide: key_dict[radionuclide])