def exponential_trace_update(trace, x, alpha_t, tau_t, dt):
    """Calculate change in cell's trace based on current trace and incoming spikes x.

    Trace updates are performed according to the following formula:
    
    .. math::

        trace_{t+1} = trace_{t} + \\frac{(-trace_{t} + alpha * x_{t}) * dt}{tau}

    :param trace: Current trace
    :param x: Incoming/presynaptic spikes
    :param alpha_t: Scaling factor for spike influence on trace
    :param tau_t: Trace decay time constant
    :param dt: Duration of single timestep

    :return: New trace values
    """
    trace += dt / tau_t * (-trace + alpha_t * x)
    return trace
