def get_relative_freqs(type2freq):
    """
    Calculates the relative frequency (proportion) of each type in a system

    Parameters
    ----------
    type2freq: dict
        Keys are types of a system and values are frequencies of those types

    Returns
    -------
    type2p: dict
        Keys are types and values are relative (normalized) frequencies
    """
    n = sum(type2freq.values())
    type2p = {t: s / n for t, s in type2freq.items()}
    return type2p