<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def triple_exponential_moving_average(data, period):
 """ Triple Exponential Moving Average. Formula: TEMA = (3*EMA - 3*EMA(EMA)) + EMA(EMA(EMA)) """

    catch_errors.check_for_period_error(data, period)

    tema = ((3 * ema(data, period) - (3 * ema(ema(data, period), period))) +
            ema(ema(ema(data, period), period), period)
            )
    return tema