def exp_filter(alpha, raw_value, value_previous):
    """An exponential filter.

    y(k) = a * y(k-1) + (1-a) * x(k)
        x(k) raw input at time step k
        y(k) filtered output at time step k
        a is a constant between 0 and 1

    Args:
        alpha (float): a smoothing constant between 0 and 1 (typically 0.8 to 0.99)
        raw_value (float): raw input value at current time step
        value_previous (float): filtered value from previous time step

    Return:
        The updated filtered value
    """
    return alpha * value_previous + (1 - alpha) * raw_value