def validate_DATERANGE(value, restriction):
    """
        Test to ensure that the times in a timeseries fall between a lower and upper bound
        Parameters: A timeseries in the form [(datetime, val), (datetime, val)..]
        and a tuple containing the lower and upper bound as datetime objects.
    """
    if len(restriction) != 2:
        raise ValidationError("Template ERROR: Only two values can be specified in a date range.")

    if type(value) == pd.DataFrame:
        dates = [get_datetime(v) for v in list(value.index)]
    else:
        dates = value

    if type(dates) is list:
        for date in dates:
            validate_DATERANGE(date, restriction)
        return

    min_date = get_datetime(restriction[0])
    max_date = get_datetime(restriction[1])
    if value < min_date or value > max_date:
        raise ValidationError("DATERANGE: %s <%s> %s"%(min_date,value,max_date))