def dynamics(state, time, config, intervention=None):
    """Update equations for the HIV simulaton.

    Parameters
    ----------
        state:  np.ndarray, list, or tuple
            State of the dynamics
        time:   float
        config: hiv.Config
            Simulator configuration object that determines the coefficients
        intervantion: hiv.Intervention
            Simulator intervention object that determines when/how to update the
            dynamics.

    Returns
    -------
        ds_dt: list
            Derivative of the dynamics with respect to time

    """
    if intervention and time >= intervention.time:
        config = config.update(intervention)
    (uninfected_T1, infected_T1, uninfected_T2, infected_T2, free_virus,
        immune_response) = state
    delta_uninfected_T1 = config.lambda_1 - config.d_1 * uninfected_T1 - (1 -
        config.epsilon_1) * config.k_1 * free_virus * uninfected_T1
    delta_infected_T1 = ((1 - config.epsilon_1) * config.k_1 * free_virus *
        uninfected_T1 - config.delta * infected_T1 - config.m_1 *
        immune_response * infected_T1)
    delta_uninfected_T2 = config.lambda_2 - config.d_2 * uninfected_T2 - (1 -
        config.f * config.epsilon_1) * config.k_2 * free_virus * uninfected_T2
    delta_infected_T2 = ((1 - config.f * config.epsilon_1) * config.k_2 *
        free_virus * uninfected_T2 - config.delta * infected_T2 - config.
        m_2 * immune_response * infected_T2)
    delta_virus = (1 - config.epsilon_2) * config.N_T * config.delta * (
        infected_T1 + infected_T2) - config.c * free_virus - free_virus * (
        (1.0 - config.epsilon_1) * config.rho_1 * config.k_1 *
        uninfected_T1 + (1.0 - config.f * config.epsilon_1) * config.rho_2 *
        config.k_2 * uninfected_T2)
    delta_immune_response = config.lambda_E + config.b_E * (infected_T1 +
        infected_T2) / (infected_T1 + infected_T2 + config.K_B
        ) * immune_response - config.d_E * (infected_T1 + infected_T2) / (
        infected_T1 + infected_T2 + config.K_D
        ) * immune_response - config.delta_E * immune_response
    ds_dt = [delta_uninfected_T1, delta_infected_T1, delta_uninfected_T2,
        delta_infected_T2, delta_virus, delta_immune_response]
    return ds_dt
