<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calc_mean_time_deviation(timepoints, weights, mean_time=None):
 """Return the weighted deviation of the given timepoints from their mean time. With equal given weights, the is simply the standard deviation of the given time points: 2.0 One can pass a precalculated or alternate mean time: 2.236068 1.732051 Or, in the most extreme case: 0.0 There will be some checks for input plausibility perfomed, e.g.: Traceback (most recent call last):
 ValueError: While trying to calculate the weighted time deviation \ from mean time, the following error occurred: For the following objects, \ at least one value is negative: weights. """

    timepoints = numpy.array(timepoints)
    weights = numpy.array(weights)
    validtools.test_equal_shape(timepoints=timepoints, weights=weights)
    validtools.test_non_negative(weights=weights)
    if mean_time is None:
        mean_time = calc_mean_time(timepoints, weights)
    return (numpy.sqrt(numpy.dot(weights, (timepoints-mean_time)**2) /
                       numpy.sum(weights)))