def _rates_seir(state, beta, sigma, gamma, n):
    """
    Calculate the intensities of the cumulated infection process and the
    recovery process.

    Parameters
    ----------
    state : dict or pd.Series
        Dictionary or pd.Series with the keys "s", "e", "i", "r". The values
        associated with the keys are integers.
    beta : float
        Parameter beta of the SEIR model.
    sigma : float
        Parameter sigma of the SEIR model.
    gamma : float
        Parameter gamma of the SEIR model.
    n : int
        Parameter N of the SEIR model.

    Returns
    -------
    rate_e : float
        Rate at which a susceptible individual becomes exposed.
    rate_i : float
        Rate at which an exposed individual becomes infectious.
    rate_r : float
        Rate at which a recovery occurs.
    change_rate : float
        Sum of the other returned rates.
    """
    rate_e = beta * (state["s"] / n) * state["i"]
    rate_i = sigma * state["e"]
    rate_r = gamma * state["i"]
    change_rate = rate_e + rate_i + rate_r
    return rate_e, rate_i, rate_r, change_rate